Sorting and Searching - common sorting and searching algorithms, hashing - Question Bank
1. What is the main purpose of rehashing in a dynamic hash table?
2. Which collision resolution technique uses a linked list at each array index to store elements that hash to the same value?
3. What is the space complexity of Quick Sort (in-place version)?
4. Which searching algorithm has a worst-case time complexity of O(n) but can be faster than Binary Search if the element is likely to be near the beginning of the list?
5. What is the primary advantage of using a hash table with a good hash function and collision resolution strategy?
6. Which sorting algorithm is generally considered the fastest for average-case performance on random data?
7. What happens to the performance of hashing if the load factor becomes very high?
8. Which of the following is NOT a common probing strategy for open addressing in hashing?
9. What is the time complexity of Radix Sort for numbers with d digits and a base b?
10. Which sorting algorithm can be used for non-numeric data like strings?
11. In hashing, what is 'primary clustering'?
12. What is the average time complexity of Jump Search on a sorted array?
13. Which searching algorithm involves jumping ahead by fixed steps and then performing a linear search?
14. What is the worst-case space complexity for Merge Sort?
15. Which sorting algorithm is known for its efficiency on large datasets and is often used in standard libraries?
16. In Quadratic Probing, if the initial hash index is h(k), the probe sequence is typically represented as:
17. Which of the following is a characteristic of a 'good' hash function?
18. What is the primary advantage of using a hash table over an array for lookups?
19. Which sorting algorithm has a time complexity of O(n^k) where k is typically greater than 1, for certain inputs?
20. What is the time complexity of searching for an element in a hash table when using Separate Chaining and assuming uniform hashing?
21. Which searching algorithm can be used on unsorted data?
22. What is the primary disadvantage of Quadratic Probing compared to Linear Probing?
23. Which collision resolution technique uses a secondary hash function to determine the step size for probing?
24. In the context of hashing, what is the 'load factor'?
25. What is the main advantage of Shell Sort over Insertion Sort?
26. Which of the following is a stable sorting algorithm?
27. What is the time complexity of Heap Sort?
28. Which sorting algorithm uses a heap data structure?
29. What is the space complexity of Bubble Sort and Selection Sort (in-place versions)?
30. Which sorting algorithm is adaptive, meaning its performance improves if the input array is already partially sorted?
31. What is the main goal of a good hash function?
32. Which of the following is NOT a common hash function?
33. What is the ideal time complexity for search, insertion, and deletion operations in a hash table with no collisions?
34. Separate Chaining is a collision resolution technique where each slot in the hash table points to what?
35. Which collision resolution technique involves probing for the next available slot in a linear fashion?
36. What is a collision in the context of hashing?
37. Which searching technique uses a hash function to map keys to indices in an array?
38. What is the average time complexity of Binary Search?
39. In Binary Search, at each step, how is the search space reduced?
40. What is the time complexity of Linear Search in the worst case?
41. Which searching algorithm requires the data to be sorted beforehand?
42. What is the worst-case time complexity of Quick Sort?
43. Which sorting algorithm works by repeatedly finding the minimum element from the unsorted part and putting it at the beginning?
44. What is the primary advantage of Merge Sort over Quick Sort in certain scenarios?
45. In Insertion Sort, how is an element inserted into its correct position in the already sorted part of the array?
46. Which sorting algorithm has a time complexity of O(n log n) in all cases (best, average, and worst)?
47. What is the best-case time complexity of Bubble Sort?
48. Which sorting algorithm divides the list into two halves, sorts them recursively, and then merges the sorted halves?
49. What is the average time complexity of Quick Sort?
50. Which sorting algorithm is known for its simplicity and is often taught first, but has a worst-case time complexity of O(n^2)?