Computer Science EngineeringHard
The auxiliary space used by a recursive DFS on a graph with V vertices, in the worst case, is
- A. O(1)
- B. O(E)
- C. O(log V)
- D. O(V)
Correct answer: D. O(V)
The recursion stack can grow to V frames, for example along a path.
Practise more Algorithms, Data Structures & Programming (ISRO CS) questionsAlgorithms, Data Structures & Programming (ISRO CS): notes and key points
More Algorithms, Data Structures & Programming (ISRO CS) questions
- What does f(37) return for int f(int n){ if(n==0) return 0; return f(n/2) + (n%2); }
- How many structurally distinct binary trees exist with 5 nodes?
- Which of the following algorithms can detect a negative-weight cycle reachable from the source?
- The worst-case running time of the Rabin-Karp string matching algorithm (text length n, pattern length m) is
- What is the Theta bound for: for(i=0;i<n;i++) for(j=0;j<n;j++) for(k=0;k<j;k++) c++;
- After one complete left-to-right bubble sort pass over [5, 1, 4, 2, 8], the array is