Time Allowed: Three Hours 27 June, 2017, 1PM-4PM: Instructions To Candidates
Time Allowed: Three Hours 27 June, 2017, 1PM-4PM: Instructions To Candidates
Time Allowed: Three Hours 27 June, 2017, 1PM-4PM: Instructions To Candidates
INSTRUCTIONS TO CANDIDATES
ADDITIONAL MATERIALS
None
Page 1 of 4
1. 1. Illustrate the doubly linked list with a suitable diagram
2. Why is it not practically possible to remove an element from the tail of a singly linked list. Illustrate
with an example
3. Write an algorithm to remove an element from the tail of a Doubly linked list
4. The following is an illustration of a doubly linked list, write an algorithm to remove 19 from the list
12 19 55 70
5. Write the algorithm to insert 60 into the above doubly linked list
Page 2 of 4
4. 1. What are the 4 properties that you have to satisfy when inserting keys to a red-black tree
2. Insert the following key values to a red-black tree, diagrammatic representation is required at each
step “34, 12, 56, 28, 94, 85, 72, 19, 27, 36, 11, 91, 68, 52, 73”
3. Write a short note on algorithm analysis, your answer should include what are the different
scenarios arising in that and what scenario we can use best to analyze an algorithm. You can also
use a graph to illustrate that.
4. find the “Big O” of the following functions
I. 25X3 + 3000XlogX +1000000X
II. 59logX + X
III. X2 + 400XlogX
IV. 2X+4 + 150logX
5. The data given here refers to the following question “34, 12, 56, 28, 94, 85, 72, 19, 27”
5.1. Illustrate the divide-and-conquer method using Quick sort
5.2. Sort the above data set using the Quick sort, diagrammatic representation is required
5.3. Write the algorithm for the Merge sort
5.4. Sort the above data set using the Merge sort, diagrammatic representation is required
6. 1. Insert the following data to a binary search tree “34, 12, 56, 28, 94, 85, 72, 19, 27, 36, 11, 91, 68,
52, 73”
I. Preorder traversal
II. In order traversal
III. Post order traversal
4. Remove the following values from the above binary search tree
I. 19
II. 56
Page 3 of 4
7. 1. Illustrate breadth first search with a suitable diagram
2. Find the shortest path from the vertex O to all other vertices
2 10 6
A B C
O
5 7
5 6
4 14
15 P
E F
D
13 6
17 3
2 3
7 5 5 Q
G H I J
7 8
3
9 3 7
9
K T
5 5
12 11 15 R
10 17
S
2 4 V
U
3. Using Kruskal’s algorithm find the minimum spanning tree for the above diagram
Page 4 of 4