Which of the following sorting algorithms has the best average-case time complexity?
Merge Sort
Bubble Sort
Selection Sort
Insertion Sort
If an algorithm has a time complexity of Ω(n log n), what can you conclude about its best-case runtime?
It will always be faster than an algorithm with O(n) time complexity.
It cannot be faster than an algorithm with O(log n) time complexity.
It will always be slower than an algorithm with O(n^2) time complexity.
It will have a constant runtime regardless of input size.
Which of the following recurrence relations represents the time complexity of the merge sort algorithm?
T(n) = T(n-1) + O(n)
T(n) = T(n/2) + O(n)
T(n) = 2T(n-1) + O(1)
T(n) = 2T(n/2) + O(n)
What is the time complexity of inserting an element at the beginning of a singly linked list?
O(n log n)
O(log n)
O(n)
O(1)
Dynamic programming aims to reduce the time complexity of an algorithm by:
Using a greedy approach to always make the locally optimal choice
Storing the results of overlapping subproblems to avoid redundant computations
Employing a divide-and-conquer strategy to break down the problem into smaller instances
Dividing the problem into smaller subproblems and solving them recursively
Which asymptotic notation provides an upper bound on an algorithm's runtime, but the bound may not be tight?
Big Omega (Ω)
Big Theta (Θ)
Little-o (o)
Big-O (O)
Which of the following scenarios typically leads to an algorithm with linear time complexity, O(n)?
Performing a linear search on a sorted array.
Calculating the Fibonacci sequence recursively.
Finding the smallest element in a max-heap.
Traversing a binary tree.
An algorithm processes an input of size 'n' by dividing it in half repeatedly until the size becomes 1. What is the most likely time complexity of this algorithm?
O(n^2)
What is the time complexity of calculating the nth Fibonacci number using the dynamic programming approach?
O(2^n)
You need to design an algorithm that operates on a very large dataset. Which time complexity should you aim for to ensure reasonable performance?
O(n!)
O(n^3)