University of Juba
DATA STRUCTURES AND ALGORITHMS
TAKE HOME ASSIGNMENT
Deadline: Just before DSA Examination
Question One:
a) The base address of the array is 2854 and it’s of maximum length of 10 and was
declared as a float type. Assuming the computer stores a float in 2 words, calculate
the address of h [9].
b) Explain how the computer stores an array in memory when execution of the program
starts.
Question Two:
Using the linked list below, answer the following questions:
a) Draw each step with cur, prev and target for searching from the head of the linked
list for a node containing 19 and if it is not present then insert a node pointed to by
target and containing 19. (5 marks)
b) Draw each step with cur, prev and target for searching from the head of the linked list
for a node containing 18 and if it is present delete it from the linked list (5 marks)
Question Three:
a) Identify the trees below as complete binary trees or not giving reasons from the
below trees. (4 marks)
b) List all the conditions that a tree must meet to become a complete binary tree (6 marks)
c) Show the results of traversing the binary tree above using each of the following
traversal techniques:
i) Pre-Order traversal
ii) In-Order traversal
iii)Post-Order traversal
Question Four:
Suppose we wish to retain the sales of 3 types, A, B & C of French bread over a weekend
as shown in the table below:
a) Define what a Cartesian product is and calculate its value for the above two-
dimensional array above.
b) Distinguish between a row major and column major implementation of a 2-
dimensional array at the hardware level i.e. in memory.
c) Use the row major technique to find the address of the quantity of type C bread
sold in day 2.
Question Five:
a) Define the ADT Linked List.
b) Use linked list to implement the stack data structure using C++ language.
c) Repeat part b) above using a sequential list.