Professional Documents
Culture Documents
DST Questions
DST Questions
DST Questions
Define the following terms as they are used in data structures and algorithms.
(i) Pseudocode
(ii) Algorithm
(iii) ADT
(iv) Data abstraction
(v) Pointer [ 10 marks]
Question 2
Distinguish between the following, supporting your answers with skeleton program segments
Question 3
Given two 2 x 2 matrices, A and B, Write a program ( using procedures and functions) that accepts the two
matrices and find their product as matrix C. [ 30 marks]
Question 4
(a) Write an algorithm that performs a sequential search on an array of items.
(b) Write a procedure that counts the number of nodes in a linked list and print the number of nodes
[20 marks]
Question 5
Assuming the following declarations
Const
N =99;
Type
Numset = set of 1..n;
Var
S : Numset;
(a) Write a procedure to build a set S of size determined by the user [ 10 marks]
(b) Search for an integer determined by the user in the set [ 10 marks]
Question 1
Define the following terms as they are used in data structures and algorithms.
(vi) Pseudocode
(vii) Algorithm
(viii) ADT
(ix) Data abstraction
(x) pointer
Question 1
(i) Define stack data structure
(ii) Describe the features/ characteristics of a stack data structure ( also look at the diagrammatic
interpretation of stacks)
Question 1
(c) Write an algorithm that performs a sequential search on an array of items.
(d) Write a procedure that counts the number of nodes in a linked list and print the number of nodes
Question 1
Type
Student = Record
Stud_num : integer;
Stud_name: String;
Class : String;
End;
Question 1
(i) Define recursion
(ii) Write a recursive function (fact) to calculate the factorial of a number 9n0 passed as a value
parameter.
Question 1
(i) Obtain the preoder, inorder and postorder traversal of a give tree
(ii) Define graph data structure
(iii) Find the degree and indegree of a graph
(iv) Distinguish between connected and complete graph
Question 1
Write an algorithm to build a single linked list