Question 71
HardWhat does T(n) = T(√n) + 1 solve to?
- A.
Θ(1)
- B.
Θ(log n)
- C.
Θ(√n)
- D.
Θ(log log n)
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Data Structures and Algorithms
What does T(n) = T(√n) + 1 solve to?
Θ(1)
Θ(log n)
Θ(√n)
Θ(log log n)
Sign up free to see the answer and a step-by-step explanation.
Which is the tightest bound for inserting n items into an initially empty binary heap one by one?
O(n log n) in the worst case
O(log n)
O(n)
O(n²)
Sign up free to see the answer and a step-by-step explanation.
Which function grows fastest?
n!
n log n
2ⁿ
n¹⁰⁰
Sign up free to see the answer and a step-by-step explanation.
Is 2ⁿ⁺¹ = O(2ⁿ)? Is 2²ⁿ = O(2ⁿ)?
Yes; yes
Yes; no
No; yes
No; no
Sign up free to see the answer and a step-by-step explanation.
A splay tree performs m operations on n nodes. What is the amortised cost per operation?
O(m)
O(n)
O(log n)
O(1)
Sign up free to see the answer and a step-by-step explanation.
A stack supports push, pop and multipop(k). What is the amortised cost per operation over any sequence of n operations?
O(1)
O(log n)
O(n)
O(k)
Sign up free to see the answer and a step-by-step explanation.
Incrementing a binary counter n times from 0: what is the amortised cost per increment?
O(log n)
O(n)
O(1)
O(n log n)
Sign up free to see the answer and a step-by-step explanation.
What is the space complexity of a recursive merge sort on a linked list (excluding the input)?
O(log n) for the recursion stack
O(n)
O(1)
O(n log n)
Sign up free to see the answer and a step-by-step explanation.
For which input size does an O(n²) algorithm with 10n² steps beat an O(n log₂ n) algorithm with 1000 n log₂ n steps?
Never
For all n
Only for small n (roughly n < 1,000)
Only for very large n
Sign up free to see the answer and a step-by-step explanation.
What is the expected time of quickselect for finding the k-th smallest of n elements with random pivots?
O(n²)
O(n)
O(n log n)
O(log n)
Sign up free to see the answer and a step-by-step explanation.