SPC 2106 Data Structures and Algorithms Year I Semester I
SPC 2106 Data Structures and Algorithms Year I Semester I
Question One
Question Two
a) Using a diagram, distinguish between a singly linked list and doubly linked list.
(4 Marks)
b) Write a C++ code snippet for an insertion sort algorithm. (5 Marks)
c) Considering the Red-Black tree below, and answer the questions that follow:
Page 1 of 3
Required:
i. Calculate the ratio of red to black nodes. (3 Marks)
ii. With justification, determine whether the above red-black tree is balanced
(3 Marks)
d) Write a C/C++ code to declare a node of a doubly linked list. (5 Marks)
Question Three
Question Four
Page 2 of 3
Question Five
Page 3 of 3