Podcast
Questions and Answers
Which sorting algorithm has the best time complexity in the worst case?
Which sorting algorithm has the best time complexity in the worst case?
- Merge sort (correct)
- Bubble sort
- Insertion sort
- Heap sort
What is the recurrence for the given algorithm?
What is the recurrence for the given algorithm?
- $T(n) = T(\frac{n}{2}) + \theta(n)$
- $T(n) = T(n-1) + \theta(n)$
- $T(n) = 2T(\frac{n}{2}) + \theta(n)$ (correct)
- $T(n) = T(n-1) + \theta(1)$
In a max-heap, where is the largest element stored?
In a max-heap, where is the largest element stored?
- In the middle of the heap
- At the root (correct)
- At the leaf nodes
- At the head of the queue
When is the worst-case scenario for insertion sort?
When is the worst-case scenario for insertion sort?
'Dynamic programming' is commonly applied to which type of problems?
'Dynamic programming' is commonly applied to which type of problems?