A Topological Sorting Algorithm The basic algorithm for topological sorting is straightforward: 1. Locate a vertex with no successors. 2. Insert the vertex into the list of vertices. 3. Subtract the vertex from the graph. 4. Repetition Step 1 until all vertices have been deleted. Implement the algorithm by writing code.
Q: 7|2→27 7 →7 72 9 4 2 479 7 2 943 8 6 1 2 → 2 94 → 49 9-9 4 → 4| 3 8 6 1 → 1368 3838 3 →3 88 6 1 → 1…
A: Sorting algorithms are used in many different applications such as search algorithms, computational…
Q: Please make a CORBA IDL only accessed by the client for the following: Create a server program…
A: module GameServer { struct Credentials { string username; string password; }; struct…
Q: Question 13 gulab Consider the Binary Search Tree(BST) provided below: /* Class to represent Tree…
A: Algorithm: START If the root node is null, return. Create an empty queue. Add the root node to the…
Q: Filter Homeroom by 105 and 220-B, then First Name that begins with "A" and "M "and then filter all…
A: The data is filtered as per the requirement
Q: How would you attach endpoint devices and infrastructure devices in a local area network? Which…
A: To connect endpoint devices and infrastructure devices in a local area network, you can use various…
Q: s the need for two passwords to access a system an example of two factor authentication? Why
A: Authentication is a process to verify the user by entering the correct details. If the details match…
Q: Create a Java programme to test the HuffmanTree class. a.The programme will need to read a text…
A: In the below program, the HuffmanTree class is assumed to be already implemented. The readFile and…
Q: Sort by Last Name (desc), then T-Shirt Size (asc) and then Payment Method (desc). 2. Freeze row…
A: Both answers are explained below
Q: n C++ can I get a working code exampe of a program that reads in a file called 10RandomAges.txt that…
A: Step-1: StartStep-2: Include necessary header files: iostream, fstream, cmathStep-3: Declare an…
Q: Which of the following are Template Methods (A.K.A. Hollywood methods). Select all that apply. func…
A: Template Method is a design pattern in object-oriented programming that defines the skeleton of an…
Q: For some coding practice I am trying to do some extra problems on the side and cannot figure this…
A: import javax.swing.JOptionPane; public class Count21 { public static void main(String[] args) {…
Q: 9] c. Following your response in (b), write a function to find the minimum positive integer that is…
A: 1. Remove all negative numbers and numbers greater than the length of the list, and replace them…
Q: The term "public cloud" describes cloud services provided by (a) A company; A internal…
A: Public cloud computing is a vital aspect of today's technology landscape, offering scalable and…
Q: What has affected the overall accessibility to V.R. therapy? Why are people not able to access V.R.…
A: Virtual Reality (VR) therapy is an emerging field that offers numerous benefits for mental health…
Q: Explain why the balanced scorecard is so crucial for optimising returns.
A: The balanced scorecard is a strategic management tool that helps organizations align their business…
Q: Problem#2 23. Reading Rates The reading speed of second grade students is approximately normal, with…
A: For statistical computation and graphics, many people use the free and open-source R programming…
Q: Why is it crucial that business information remain secret? What kinds of abuse spring to mind if…
A: It is crucial for businesses to keep their information secret for a variety of reasons, including…
Q: What do you think the functional and nonfunctional requirements are for your favorite internet…
A: Functional supplies describe the features and capability a system must have to fulfill its purpose.…
Q: In graph G switching centers represented by vertices and edges represent communication lines between…
A: Java is a platform-independent, object-oriented programming language used programming language for…
Q: using trisate create a 2:1 multiplexer
A: Tristate buffers have a normal input, an output, and a control input that determines the state of…
Q: Write a C++ program that uses recursion to calculate the factorial of a number
A: Recursion is a programming technique that involves a function calling itself repeatedly until a…
Q: What should a DBA be doing to keep a DBMS working well after it has been chosen?
A: A DBA, or database administrator, is essential to the effective and efficient operation of a…
Q: Laws impose limitations on how to secure sensitive data, whereas ethics provide suggestions on how…
A: Privacy is a fundamental right that is often challenged by the increasing use of data in various…
Q: One linear structure might be more applicable than another. (A) Can a Stack be used to implement a…
A: The linear structure stores the data components in a linear sequence. Arrya, linked list, stack and…
Q: What specifically do we mean when we refer to embedded systems? Discuss the embedded system's many…
A: Meaning of Embedded Organizations Importance and Importance of Embedded Techniques in modern…
Q: How can I make the Left Menu accessible through a shortcut key?
A: Making the Left Menu accessible through a shortcut key typically involves implementing keyboard…
Q: Operating System PowerShell Find out which Windows features are installed on the server. Pay special…
A: Find out what Windows features are installed on the server machine.Select only the data stored in…
Q: Provide an explanation of the three categories of data and their definitions.
A: Data is any information that is handled by a computer system. As a general rule, data can be sorted…
Q: Assume we have a limited number of data points for training and validation and we are using k-fold…
A: Cross-validation is a common technique used in machine learning to evaluate the performance of a…
Q: Hello hope you’re having a great day, can you help me with this computer organization assignment?…
A: Here's a short description of the counter design and testing process: To design a counter that…
Q: Give an example of when one of the four possible access control techniques may be employed. What…
A: An Introduction of Access Control Techniques : Access control is a security approach used to…
Q: You should not make any changes to DPQueue.h. ● Fill in the implementation of all the "stub"…
A: DPQueue.cpp This file implements p_queue The number of items in the p_queue is stored in the member…
Q: We spoke about how the operating system allots memory to processes and where they are located when…
A: Yes, virtual memory is utilized by mobile operating systems such as Android and iOS. Virtual memory…
Q: What software or hardware may be placed on a laptop to stop shoulder surfing?
A: Here is your solution :
Q: What are the advantages and disadvantages of using a hosted software programme to "test drive" a…
A: This question comes from Software Engineering which is a paper of Computer Science. Let's discuss it…
Q: 1. You can manage risk in your orders by adding the TakeProfit/StopLoss attributes using fxcmpy.…
A: The world of finance is vast and complex, with many different tools and techniques used to manage…
Q: If two objects are coupled, the implementation of each can change or be reused without the need to…
A: If two objects are tightly coupled, changes to the implementation of one object can affect the…
Q: What are some ways that cyber forensics may control scope and scope creep?
A: To control scope and scope creep in cyber forensics,clear objectives and constraints should be…
Q: What potential ethical and safety issues may arise when a company uses business intelligence (BI)…
A: Business Intelligence (BI) technologies are a set of tools, applications, and practices that help…
Q: You should not make any changes to DPQueue.h. ● Fill in the implementation of all the "stub"…
A: Without making any changes to the DPQueue.h header file, implement the stub functions in the…
Q: There are two schools of thought when it comes to programmer comments: (a) It is always preferable…
A: Programming is a complex and intricate process that involves creating code that not only works but…
Q: What information is used by a process running on one host to recognise a process on another server?
A: When a process running on one host needs to communicate with a process on another server, it…
Q: What does Cocoa Touch call the object that is given the first chance to handle key events and some…
A: CocoaTouch is a software framework that is used to develop applications for Apple's iOS operating…
Q: The company will no longer support your current LIS system, so you will need to select a new one.…
A: Selecting a new LIS system for your lab can be a intimidating task. There are more than a few…
Q: How do you gather and organize information for data entry?
A: The answer is given below step.
Q: A Professor wants a database for his new University that will maintain data for the following…
A: Based on the information you provided, I have constructed an Entity-Relationship (E-R) diagram for…
Q: Shuffle 10 playing cards (ace through 10) and lay them out in a row. Now sort them using the…
A: The quicksort algorithm is a popular sorting algorithm that uses a divide-and-conquer approach to…
Q: Which of the following are categories of applications that do not benefit from the MVC architecture.…
A: The question pertains to the suitability of the Model-View-Controller (MVC) architecture in…
Q: Give an explanation of what the purpose of business intelligence is and why BI tools are so…
A: Commerce intelligence" (BI) describes the method, procedures, and technologies That help…
Q: Create a program in C++ which checks for 1 bit errors in an error detection system which uses a…
A: Given that, The c++ program checks for 1 bit error in an error detection system which uses a single…
A Topological Sorting
The basic algorithm for topological sorting is straightforward:
1. Locate a vertex with no successors.
2. Insert the vertex into the list of vertices.
3. Subtract the vertex from the graph.
4. Repetition Step 1 until all vertices have been deleted.
Implement the algorithm by writing code.
Step by step
Solved in 5 steps with 3 images
- Python Graph Algorithms: Minimum Spanning Trees Note: There are helper functions (see 'required' below), and some of them (like Kruskal's Algorithm, WeightedQuickUnion, and such) can help answering this problem. Problem: Suppose you are an engineer working on designing a road network for a new town. The town has many residential areas and commercial centers that need to be connected efficiently. You decided to represent the town as a connected, undirected graph where each vertex represents a location, and each edge represents a road connecting two locations. The weight of each edge represents the distance between the two locations. To ensure the road network is efficient, you need to find the minimum spanning tree of the graph. However, due to budget constraints, you can only construct roads with a maximum distance limit. You need to determine for how many pairs of locations, the minimum spanning tree of the graph remains the same when the maximum distance limit of a road is increased…Python: Graph Colouring A simple method to find a colouring of a graph, with vertices {0,1,…,?−1}, is the following greedy algorithm: For ? in 0, 1, 2, ..., n - 1: Find the smallest colour (positive integer) ? which is not a colour of any neighbour of ?. Assign ? as the colour of ?. i) Implement the method above as a function greedy_colouring which takes a networkx Graph G (with vertices {0,1,…,?−1}) and returns a list C of the colours of G, where C[i] is the colour of vertex ?. ii) As a test, the Hoffman-Singleton graph (nx.hoffman_singleton_graph()) should require 6 colours using this method. If you have a graph G, you can draw it with coloured vertices using the code below: ten_colours = ['#CC6677', '#332288', '#DDCC77', '#117733', '#88CCEE', '#882255', '#44AA99', '#999933', '#AA4499', '#DDDDDD'] nx.draw_networkx(G, node_color=[ten_colours[i - 1] for i in greedy_colouring(G)], with_labels=False) iii) One way of refining the…MazeSolver attempts to recursively traverse a Maze. The goal is to get from the * given starting position to the bottom right, following a path of 1’s. Arbitrary * constants are used to represent locations in the maze that have been TRIED * and that are part of the solution PATH.
- 1) Design an algorithm using DFS that detects whether graph G has a cycle. State and explain running time. Graph G need not be connected. Write in Pseudocode, please. 2) BFS refresher: Suppose you have an n × n chessboard and a knight placed in one of the squares. Youwould like to find out the fewest number of moves needed to reach a given target square. Design an algorithmfor this task stated formally below: Input: An n × n chess board, a starting square S, and a target square T.Output: The fewest number of moves a knight takes to move from S to T. Write in Pseudocode, please.Complete the task using the return search algorithm: Task: The labyrinth is represented by a Boolean square matrix A8x8. The cell (i, j) is considered passable if the element ai, j is true and otherwise impassable. Write a program that checks if there is a path from adjacent horizontally and vertically passable cells of the maze, which starts in its upper left corner (0.0) and ends in its lower right corner (7.7). Operating instructions: 1) Compose a Boolean function Path (i, j), called with initial parameters (0,0); 2) If cell (i, j) is outside the matrix Path returns false; 3) If cell (i, j) coincides with (7,7) a path is found and Path returns true; 4) If cell (i, j) is impassable Path returns false (because it cannot exit the cell), otherwise (if the cell is passable) there is a path from it to cell (7,7), if there is a path from any of the cells adjacent to (i, j) next to cell (7,7). Adjacent cells per cell (i, j) are cells (i + 1, j), (i, j + 1), (i-1, j), (i, j-1).Searching and Sorting Sort a singly linked sequential list using bubble sort algorithm. Sort a singly linked sequential list using selection sort algorithm. Sort a DOUBLY linked sequential list using insertion sort algorithm. Implement binary search algorithm RECURSIVELY. Implement a recursive algorithm to find the n-th Fibonacci number using memoization.Instructions Complete the following methods on Searching and Sorting. You may use any language Java or Python to complete the tasks. If you are using JAVA, you must include the Tester class containing the main method which should test your other methods. If you are using PYTHON, make sure your code has the methods invoked through test statements. Usage of built in methods/libraries are NOT ALLOWED
- Artificial Intelligence - Local Search Starting from a randomly generated state of the 15-puzzle game, steepest-ascent hill-climbing (the vanilla version of hill-climbing search) gets stuck 76% of the time, i.e., solving only 24% of problem instances. But it works very quickly, i.e., it takes just 6 steps on average when it succeeds and 5 steps when it gets stuck. In contrast, if sideways moves are allowed, this raises the percentage of problem instances solved by hill-climbing from 24% to 81%, with the success at a cost: the algorithm averages roughly 7 steps for each successful instance and 32 steps for each failure. Now suppose that we are implementing random-restart hill climbing (i.e., if a search fails, it keeps to try, and try, until it gets a success) by the following two versions: one uses vanilla steepest-ascent hill climbing, and the other one uses hill climbing with sideways moves. Can you please tell which version of random-restart hill-climbing listed above runs faster…Yusuf: C X 0 F1 umn.instructure.com/courses/342857/external_tools/retrieve?display=full_width&url=https%3A%2F%2Fumn.quiz-Iti-iad-prod.instructure.com ... D 2 L Given: Member m = new Board Member(); What will be printed by: System.out.println(m.toString()); ۲ 3 F2 W .. ص X Output: Searching A at: Searching C at: Searching X at: Searching Et: S >>> س eturn -1 if The BTNodeGen instance method search(T s) in the class above is intended to return the depth of the data items in the tree if it is found, and r item s is not found in the tree. Given the tree below, show the output that will be produced if the main() fragment were run, assuming the tree, t, is the followi ng: # 3 r L E 20 F3 $ 4 ی D уу. ي Without actually re-writing the code, briefly describe two changes needed to make search(T s) give the correct output. R W F L. G 000 900 F4 in with this one. thi Gill 5 ق 67 5⁰ "A" (depth 1) "B" "C" (depth 2) // (depth 3) "D" "E" % & ។ 7 V 8 28 Y.2⁰. AA F7 غ ز * H IJ X U .... o: W E A CSV B…1. The algorithm SkipListSort is a sorting algorithm that begins by inserting a sequence of keys into a skip list. 1. Once you had done that, what would the remaining steps in the algorithm be? 2. Give an asymptotic notation that best describes how long it would take to sort n keys this way (i.e., the entire SkipListSort algorithm) and briefly explain (in a sentence or two) why. 2. The algorithm HashSort is a sorting algorithm that begins by inserting a sequence of keys into a hash table. 1. Once you had done that, what would the remaining steps in the algorithm be? 2. Give an asymptotic notation that best describes how long it would take to sort n keys this way (i.e., the entire HashSort algorithm) and briefly explain (in a sentence or two) why.
- Single source shortest path Algorithm 1. Implement the algorithm2. Write comments3. Screenshot of output /// Single source shortest path#include <stdio.h>#define INFINITY 9999void SingleSource(int graph[50][50], int qv, int start_ver);void main(){ int graph[50][50],qv, start_ver; int i,j; printf("\nEnter the quantity of vertexes:"); scanf("%d", &qv); printf("\nEnter the values for path costs matrix:\n"); for(i=0; i< qv; i++) for(j=0; j<qv; j++) scanf("%d", &graph[i][j]); printf("\nEnter the starting vertex:"); scanf("%d",&start_ver); SingleSource(graph, qv, start_ver); printf("\n\n\n"); return 0;}void SingleSource(int graph[50][50], int qv, int start_ver){ int eadgecost[50][50]; int distance[20]; int gen[50]; int visited[50]; int i,j; for(i=0; i<qv; i++) for(j=0; j<qv; j++) if (graph[i][j]==0) /// inserted single "=" instead of "=="…Breadth-first search must be done without recursion. (with iterative)In computer science and mathematics, the Josephus Problem (or Josephus permutation) is a theoretical problem. Following is the problem statement: There are n people standing in a circle waiting to be executed. The counting out begins at some point (rear) in the circle and proceeds around the circle in a fixed direction. In each step, a certain number (k) of people are skipped and the next person is executed. The elimination proceeds around the circle (which is becoming smaller and smaller as the executed people are removed), until only the last person remains, who is given freedom. Given the total number of persons n and a number k which indicates that k-1 persons are skipped and kth person is killed in circle. The task is to choose the place in the initial circle so that you are the last one remaining and so survive. For example, if n = 5 and k = 2, then the safe position is 3. Firstly, the person at position 2 is killed, then person at position 4 is killed, then person at position 1…