Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE NOTE THAT THIS ASSIGNMENT IS 4 PAGES AND WITH A TOTAL OF 40 POINTS. QUESTION 1: [10 POINTS] Choose the correct answer from the
PLEASE NOTE THAT THIS ASSIGNMENT IS 4 PAGES AND WITH A TOTAL OF 40 POINTS. QUESTION 1: [10 POINTS] Choose the correct answer from the following: 1. In the merge step of Merge sort of N elements what is the running time cost of that step? a. Q(1) b. O(log N) c. O(N) d. O(N log N) e. O(N2) 2. One of the following is used in Topological Sorting a BFS b. DFS c. Heap d. All of them 3. Memory required to represent a graph using adjacency list is: a (ED) b. ([V1) c. (|V[ + |ED d. None of them 4. Time to determine if(u, v) E in a graph represented by adjacency matrix is: a. (1) b. (log |VD c. O (degree(u)) do (degredv)) e. OCIED 5. The INCREASE-KEY operation in a priority queue with Size N has running time: a. Q(1) b. O(log N) c. O(N) d. O(N log N) e. O(N) 6. The minimum number of comparisons needed to find the Simultaneous Min, Max values of n even elements is a. 2n-1 b. (3n-3)/2 C. (31/2)-2 d (3n-2)/2 7. The running time of the best algorithm for finding the median of a sorted sequence of n values is in the order (Big-0) of a. Ign b. n3 c. 1 d. 1 8. The running time needed to determine if the edge (u, v) E and the graph represented by an adjacency list: a. O(degree(u)) b. VED C. ([V] + [ED d. @C|VD 9. The running time needed to traverse the adjacent nodes for the node u in the graph represented by an adjacency matrix a. (degree(u)) 6. OCED c. ([V] + |ED d. O(IVD 10. The running time of breadth-first search on a graph G(V, E) represented in an adjacency list is a. O(E) b. O(E+V) c. O(V2) d. O (E log V) e. None QUESTION 2: [7 POINTS] Given the following adjacency matrix representation of a graph to answer the followed questions. 0 1 1 1 0 0 1 0 0 0 1 0 1 0 1 A. [1 POINT) is it directed graph or not and why? 0 1 0 O 1 1 0 1 1 0 B. [1 POINT] How many vertices are there in the graph? C. [I POINT] How many edges are there in the graph? D. [3 POINT] reRepresent the graph using an adjacency list. E. [1 POINT] Draw the original graph QUESTION 3: [6 POINTS] A- [4 POINTS] Apply heap sort in the following array and show your work over the tree you build Show all your steps. 18 1311 7 14 10 4 255 B- [2 POINTS] How many times the max-heapify function is called through the entire sorting. QUESTION 4: [17 POINTS We consider the directed graph G = (V, E) shown below, and assume that the adjacency lists for all vertices are sorted by increasing vertex indices. 14 6 8 A) [8 POINTS] Run DFS(G) and show discovery time, finish time and predecessor for each node. And show the DFS forest. B) [2 POINTS] How many times in total has DFS-Visit has been called? C) [7 POINTS] Run BFS (G, 0) starting with source 0. Show the Queue after each step. Show also d[], P[] lists and BFS tree
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started