Computer Science EngineeringVery hard
The recurrence T(n) = 2T(n/2) + n log n solves to
- A. Theta(n log n)
- B. Theta(n^2)
- C. Theta(n)
- D. Theta(n log^2 n)
Correct answer: D. Theta(n log^2 n)
This is the extended case 2 of the master theorem with k=1, giving Theta(n log^(k+1) n) = Theta(n log^2 n).
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
- Consider int f(int n){ if(n<=1) return 1; return f(n-1)+f(n-2); }. What does f(6) return?
- Quicksort that always picks the first element as pivot runs in what time on an already sorted array?
- Dijkstra's algorithm using a binary heap and adjacency lists runs in
- For n a power of 2, what is the Theta bound of the loop: x=0; for(i=1;i<=n;i=2) for(j=0;j<i;j++) x++;
- How many leaf nodes does a binary heap stored in an array of 15 elements have?
- A table of size 7 uses h(k) = k mod 7 with linear probing. After inserting 15, 22, 8 and 1 in that order, at which index does key 1 reside?