Professional Documents
Culture Documents
Bit2102 Bit3101a Bbit106 Data Structures and Algorithms
Bit2102 Bit3101a Bbit106 Data Structures and Algorithms
[6 Marks]
d) Describe two implementations of queue data structure.
[4 Marks]
QUESTION FOUR [20 MARKS]
a) If you push the letters F, A, C and E in order onto a stack of characters and then pop them, in
what order will they be deleted from the stack?
[5 Marks]
b) Define a recursive function and give any two examples that can be solved recursively.
[4 Marks]
c) The numbers 20, 70, 68, 59,30,15,90,70,60,85 are to be stored for some processing in that
order. Write down the order in which the numbers will be printed if they are:
i. stored in a queue
ii. stored in a stack and
iii. stored in a binary search tree and traversed in order.
[9 Marks]
d) Explain the sufficient conditions for a binary tree to be a heap.
[2 Marks]
QUESTION FIVE [20 MARKS]