Topology Sort
Step Visited
Sorted
10
I
D
9
D
I
8 H
H
7
C
J
6
F
A
5
A
F
4
G
C
3
B
E
2
E
G
1
J
B
PoP From Up to Down From Sorted Stack
So Sorted List for order 1 is --> D I H J A F C E G B
Step
Visited Sorted
10
H
H
9
E
D
8
J
J
7
D
E
6
A
I
5
I
A
4
B
F
3
G
G
2
F
B
1
C C
PoP From Up to Down From Sorted Stack
So Sorted List for order 2 is --> H D J E I A F G B C
1. (5 pts) Perform topological sorting on the directed graph below. Show two orderings that can...
Consider the following directed graph for each of the problems: 1. Perform a breadth-first search on the graph assuming that the vertices and adjacency lists are listed in alphabetical order. Show the breadth-first search tree that is generated. 2. Perform a depth-first search on the graph assuming that the vertices and adjacency lists are listed in alphabetical order. Classify each edge as tree, back or cross edge. Label each vertex with its start and finish time. 3. Remove all the...
For the following questions, use the graph (starting node: S) below: 14. Show DFS traversal. 15. Show BFS traversal. 16. Show the result of a topological sorting of the graph 17. Dijikstra's single source shortest paths for all nodes 18. Show a tabular form soultion of following 0/1 knapsack problem. Value {5,7, 3, 10, 12, 4, 10} Weight {2,3,1,5, 6, 2,4} Total Weight: 12 19. Show a solution to Fractional knapsack problem with the same weight, value, and total weight...
please directly show me the answers 8) (20 pts) Running times. Each question has 2pts. A. Can be solved in linear time in the worst case. B. Can be solved in polynomial time in the worst case. C. Can be solved in exponential time in the worst case. D. Cannot be solved/computed with any algorithm Match each task below with the best-matching description above. For the purposes of this question, assume PNP. Find the shortest paths from source to other...
8, (10 pts) Show that given a directed graph G = (V,E) already stored in adjacency matrix form, determining if there is a vertex with in-degree n - 1 and out-degree 0 can be done in O(n) time where n is the number of vertices in V. 8, (10 pts) Show that given a directed graph G = (V,E) already stored in adjacency matrix form, determining if there is a vertex with in-degree n - 1 and out-degree 0 can...
1. (5 marks) Perform a selection sort on the list 23, 59, 34, 13, 31, 10. Show the list after each exchange that has an effect on the list ordering. 2. (5 marks) Explain why the bubble sort algorithm does Ө(n2) comparisons on an n-element list. The bubble-sort algorithm is shown just after question 10 on p. 141. 3. (5 marks) Write the resulting data list, give the ending value of legit, and find the exact number of copies done by the converging...
PLEASE DO BOTH #5 AND #6. The purpose of the project is to perform a timing experiment. You are required to complete the following activities: Write a computer program that prompts the user for a number, creates an array for that number of random integers, and then usees the bubble sort to order the array. The program should print out the array prior to the call to the sorting algorithm and afterwards. You can write the program in either Java,...
JAVAFX ONLY PROGRAM!!!!! SORTING WITH NESTED CLASSES AND LAMBDA EXPRESSIONS. DIRECTIONS ARE BELOW: DIRECTIONS: The main point of the exercise is to demonstrate your ability to use various types of nested classes. Of course, sorting is important as well, but you don’t really need to do much more than create the class that does the comparison. In general, I like giving you some latitude in how you design and implement your projects. However, for this assignment, each piece is very...
The purpose of the project is to perform a timing experiment. You are required to complete the following activities: Write a computer program that prompts the user for a number, creates an array for that number of random integers, and then usees the bubble sort to order the array. The program should print out the array prior to the call to the sorting algorithm and afterwards. You can write the program in either Java, C++, C#, or whatever language you...
Part 1: Ratio Analysis calculate the following ratios Part 2: Perform a vertical analysis of statement of financial position & Income statement Part 3: Perform a Horizontal Analysis of statement of Financial Position for 2015 and 2014 & Income statement for 2015 Instructions: 1. On pages three and four, you will find condensed statement of financial position and income statement data for Waterloo Corporation. 2. Use the same information to answer all the three parts. 3. Part 1: a. In...
D Question 12 1.5 pts Check the true statements about NumPy arrays: O A single instantiated NumPy array can store multiple types (e.g., ints and strings) in its individual element positions. A NumPy array object can be instantiated using multiple types (e.g., ints and strings) in the list passed to its constructor O Memory freeing will require a double-nested loop. The number of bits used to store a particular NumPy array object is fixed. O The numpy.append(my.array, new_list) operation mutates...