WorksheetsHash Table and Sorting Algorithms Quiz
Total questions: 10
Worksheet time: 5mins
What is the time complexity for searching, inserting, and deleting elements in a hashtable (in the average case)?
O(1)
O(log n)
O(n)
O(n log n)
What is the function that determines the index of a key in a hashtable?
Sorting function
Mapping function
Hash function
Compression function
In open addressing, which collision resolution technique involves searching for the next available slot in a linear fashion?
Quadratic probing
Double hashing
Linear probing
Random probing
Which of the following is NOT a desirable property of a good hash function?
It should be deterministic.
It should minimize collisions.
It should map similar keys to the same hash value.
It should distribute keys uniformly across the table.
What is the primary purpose of a hashtable?
Sorting data
Storing data for quick retrieval
Compressing data
Securing data
What is the time complexity of mergesort in the worst case?
O(n²)
O(n log n)
O(log n)
O(n)
Mergesort is an example of which algorithmic paradigm?
Dynamic programming
Divide and conquer
Greedy algorithm
Backtracking
During the merging process in mergesort, what is the key operation performed?
Partitioning the array into subarrays
Comparing and combining two sorted subarrays
Searching for a pivot element
Dividing the array into smaller elements
Which of the following is a disadvantage of quicksort?
It requires additional space for merging.
Its performance is highly dependent on pivot selection.
It is not efficient for arrays.
It has a poor average-case time complexity.
When does quicksort perform worst?
When the pivot is always the median of the array.
When the pivot is always the largest or smallest element.
When the input array is already sorted.
When the array has duplicate elements.
