UNIVERSITY EXAMINATIONS: 2018/2019
EXAMINATION FOR BACHELOR OF SCIENCE IN INFORMATION
BIT 3101A: DATA STRUCTURES AND ALGORITHMS
MODE: FULL TIME/PART TIME/DISTANCE LEARNING
DATE: APRIL, 2019 TIME: 2 HOURS
INSTRUCTIONS: Award Marks for question ONE and any other TWO
QUESTION ONE [30 MARKS]
a) What are the steps to inserting a new item at the head of a linked list?
b) Discuss any four properties of a good algorithm.
c) Differentiate between walk through and desk check as used in dry run.
d) Differentiate between deque and dequeue as used in queue abstract data types(ADT).
e) Differentiate between linear and non-linear data structures. Give one example for each type.
f) Explain the differences between array and linked list data structures.
g) Breadth first search(BFS) and depth first search (DFS) are two important techniques in graph
traversal. Describe a data structure used for each of these techniques.
h) State and explain the worst-case complexity of binary search.
i) Design an algorithm using pseudo code to read some integer n, then reverse the digits
QUESTION TWO [20 MARKS]
a) Describe the scenario under which binary search algorithm can be used.
a) Describe two advantages of selection sort
b) Using stack ADT, convert the following infix expression to prefix:
𝐴 + ((𝐵 + 𝐶) * (𝐷 + 𝐸))
c) Briefly explain three methods of handling collisions in a hash table.
d) Briefly explain the best and worst case complexity.
QUESTION THREE [20 MARKS]
a) Explain how you can reference all the elements in a one-dimension array.
b) Briefly explain how a linear search algorithm works.
c) Design a pseudo code for searching using binary search tree.
d) Explain the process for selection sort.
e) Briefly explain the important factors considered while choosing a hash function.
f) What are different application of stack?
QUESTION FOUR [20 MARKS]
a) Design an algorithm using pseudo code to convert decimal number ( a number in base 10) to its
b) Take a queue containing numbers 10,15,5,25,30 in which 30 has been inserted first and 10 is the
last to be inserted. After performing the following operations, what would be the contents of the
i. Delete two elements
ii. Insert 7 and then 20
c) Write a recursive algorithm in pseudo code to calculate and display Fibonacci series once they user
keys in the number of terms n.
d) Describe the procedure of a post order traversal in a binary tree.
QUESTION FIVE [20 MARKS]
a) For each of the following statements state whether the assertion is true(T) or false(F).
i. A heap data structures is a binary tree.
ii. Binary search is used for searching in a sorted array.
iii. All nodes in a singly linked list point to some other node.
iv. In a queue, elements are both inserted and deleted from one end.
v. In depth first search(DFS), all the nodes adjacent to the current node are visited.
vi. Traversal in a graph is visiting each node at least once.
b) In the following questions, consider the list of numbers: 62, 31, 70, 91, 25, 11, 9, 61,23, 73, 96.
i. Construct a binary search tree.
ii. Traverse the tree using pre-order traversal
iii. Store the elements displayed from the traversal in ii in a hash table.