DrDSLecture11-Revision
DrDSLecture11-Revision
Linked List
1. Given a doubly Linked-list with head(front) and rear(tail) references. Write an
insert function that Insert element x at second last position.
In which slot should the record with key value 159 be inserted?
4. Given the following hash table, use hash function h(k) = k mod 11 and handle
collisions using Double Hashing with h2(k) = 1 + (k % 10).
In which slot should the record with key value 832 be inserted?
h1(832) = 7.
h2(832) = 3.
Heap
5. Sort the following list 11,2,9,13,57 in ascending order using the heap sort
algorithm
Draw the list changes step by step indicating the sorted and unsorted list in each step.
Sorting
6. Here is an array of 7 integers
5 3 8 9 1 7 0
Draw this array after each iteration of the large loop in
i. Selection sort
ii. Insertion sort
iii. Bubble sort
Sorting
7. Here is an array of 7 integers
5 3 8 9 1 7 0
Develop each partition of array using quick sort when pivot is the first element of the
array
Graph
2. Which of the following sorting algorithms in its typical implementation gives best performance
when applied on an array which is sorted or almost sorted (maximum 1 or two elements are
misplaced).
a. Quick Sort
b. Merge sort
c. Heap sort
d. Insertion sort
4. What is the time taken to perform a delete min operation in heap sort?
a. O(N)
b. O(N log N)
c. O(log N)
d. O(N^2)
1. …………………is a collection of related things linked to the previous or/and next data items.
2. …………………is a collection of values that are all have the same type.
6. …………………is a data structure which is commonly used in task scheduling and sometimes it
is called buffer
8. …………………is a data structure where the value of the root node is greater than or equal to either of
1. ………………… algorithm is generally considered the fastest sorting algorithm because it has the best
3. ………………… algorithm may have the worst-case time complexity when the array is sorted.
5. …………………,…………... algorithms will take least time when all elements of input array are
identical.