WorksheetsDS QUIZ
Total questions: 10
Worksheet time: 5mins
Given two sorted list of size m and n respectively. The number of comparisons needed the worst case by the merge sort algorithm will be
m x n
maximum of m and n
minimum of m and n
m + n - 1
If one uses a straight two-way merge sort algorithm to sort the following elements in ascending order: 20, 47, 15, 8, 9, 4, 40, 30, 12, 17 then the order of these elements after the second pass of the algorithm is:
8, 9, 15, 20, 47, 4, 12, 17, 30, 40
8, 15, 20, 47, 4, 9, 30, 40, 12, 17
15, 20, 47, 4, 8, 9, 12, 30, 40, 17
4, 8, 9, 15, 20, 47, 12, 17, 30, 40
What is the best sorting algorithm to use for the elements in an array that are more than 1 million in general?
Selection sort.
Quick sort
Bubble sort.
Insertion sort.
How many subarrays does the quick sort algorithm divide the entire array into?
1
2
3
4
What is direct addressing?
Distinct array position for every possible key
Fewer array positions than keys
Fewer keys than array positions
Same array position for all keys
What is a hash table?
A structure used to implement stack and queue
A structure that maps values to keys
A structure that maps keys to values
A structure used for storage
A Hash Function f is defined as f(key) = key mod 7. With linear probing, while inserting the keys 37, 38, 72, 48, 98, 11, and 56 into a table indexed from 0, in which location the key 11 will be stored (count table index 0 as 0th location)?
4
3
5
6
The minimum number of edges in a connected graph with N vertices is:
A) N
B) N – 1
C) N + 1
D) 2N
Binary search can only be applied on:
A) Linked list
B) Sorted array
C) Unsorted array
D) Hash table
In binary search, if the key is less than the middle element, the search continues:
A) In the right half
B) In the left half
C) In entire array again
D) Search stops
