1. What is the time complexity of accessing an element in an array by index?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n²)
2. What is the time complexity of inserting an element at the beginning of a linked list?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n²)
3. What is the best-case time complexity of quicksort?
(A) O(n)
(B) O(n log n)
(C) O(n²)
(D) O(log n)
4. What is the worst-case time complexity of quicksort?
(A) O(n log n)
(B) O(n)
(C) O(n²)
(D) O(log n)
5. What is the time complexity of searching for an element in a balanced binary search tree (BST)?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n log n)
6. What is the time complexity of merging two sorted arrays of size n?
(A) O(n log n)
(B) O(n)
(C) O(log n)
(D) O(n²)
7. What is the time complexity of deleting an element from a linked list given a pointer to that element?
(A) O(1)
(B) O(n)
(C) O(log n)
(D) O(n²)
8. What is the average-case time complexity of binary search?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n log n)
9. What is the time complexity of finding the maximum element in an unsorted array?
(A) O(n log n)
(B) O(n)
(C) O(log n)
(D) O(1)
10. What is the time complexity of the bubble sort algorithm in the worst case?
(A) O(n)
(B) O(n log n)
(C) O(n²)
(D) O(log n)
11. What is the time complexity of inserting an element into a max-heap?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n log n)
12. What is the time complexity of deleting the minimum element from a min-heap?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n log n)
13. What is the time complexity of traversing a binary tree?
(A) O(n log n)
(B) O(n)
(C) O(log n)
(D) O(n²)
14. What is the time complexity of the merge sort algorithm?
(A) O(n log n)
(B) O(n)
(C) O(log n)
(D) O(n²)
15. What is the time complexity of the selection sort algorithm?
(A) O(n log n)
(B) O(n)
(C) O(log n)
(D) O(n²)
16. What is the time complexity of searching for an element in an unbalanced binary search tree (BST)?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n log n)
17. What is the time complexity of checking if an element exists in a hash table with n elements?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n²)
18. What is the time complexity of the insertion sort algorithm in the best case?
(A) O(n log n)
(B) O(n)
(C) O(log n)
(D) O(n²)
19. What is the time complexity of deleting an element from an array, given its index?
(A) O(1)
(B) O(n)
(C) O(log n)
(D) O(n log n)
20. What is the time complexity of the Fibonacci sequence using dynamic programming?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n²)