SPC 2106 Data Structures And Algorithms
SPC 2106 Data Structures And Algorithms
Instructions
d) Distinguish between a root node and a terminal node as used in a binary tree.
(4 Marks)
e) Using a diagram, distinguish between a singly linked list and doubly linked list.
(4 Marks)
i. Stack
Page 1 of 3
Question Two
a) Use the bubble sort algorithm to sort the data elements: 43, 32,7, 12, 98. Show all
your working and indicate the number of passes. (5 Marks)
Question Three
a) Using C language, write a code snippet for the binary search algorithm.
(7 Marks)
(6 Marks)
Question Four
a) Using a diagram, distinguish between directed graph and double ended non-
directed graph. (4 Marks)
b) Using selection sort, demonstrate how the following elements: 10,56,5,29,78 can
be sorted. Show all your working. (5 Marks)
Page 2 of 3
d) With an aid of a diagram, describe a Red-Black tree (3 Marks)
Question Five
d) Using C language, write a code snippet for the linear search algorithm. (8 Marks)
Page 3 of 3