BIT 3101A   BBIT 106  BAC 2102  BSD 2101  BISF 2102   DATA STRUCTURES  ALGORITHMS.

UNIVERSITY EXAMINATIONS: 2020/2021
EXAMINATION FOR DEGREE IN BACHELOR OF SCIENCE
INFORMATION TECHNOLOGY// BUSINESS I.T/ APPLIED
COMPUTING/INFO. SECURITY & FORENSICS/ SOFTWARE DEV.
BSD 2101/BAC 2102/BISF 2102/BBIT 106/ BIT 3101A:
DATA STRUCTURES
ORDINARY EXAMINATION
MODE: PART TIME/FULL TIME/DISTANCE LEARNING
DATE: DECEMBER, 2021 TIME: 2 HOURS
INSTRUCTIONS: Answer question ONE COMPULSORY and any other TWO questions

QUESTION ONE [20 MARKS]
a) Define data types (1 Mark)
b) Distinguish between Abstract data types and basic types in data structures (2 Marks)
c) Considering a Stack, illustrate three operations that can be performed on a Stack
(3 Marks)
d) Discuss the following as they relate to algorithms (2 Marks)
i. BFS
ii. DFS
e) Lists and arrays have a number of similarities as well as differences. Describe a scenario
where arrays would be better than lists. (2 Marks)
f) Illustrate how you would do a selection sort for the following array (4 Marks)
arr[] = 64 25 12 22 11
g) Suppose the values of N as 10 perform line by line dry run for the following algorithm and
state the output.


(6 Marks)
QUESTION TWO [15 MARKS]
a) Discuss the steps involved in the development of an algorithm. (5 Marks)
b) Given the array below, use Quick Sort to arrange the elements in ascending order.
(8 Marks)


c) Consider the binary tree below:


Write the order of the nodes visited in:
i. An in-order traversal.
ii. A pre-order traversal. (2 Marks)
QUESTION THREE [15 MARKS]
a) Name three Linear Data Structures (3 Marks)
b) Given the graph below, using depth first search traverse the graph and give the resultant order.


(7 Marks)
The following sequence of operations were performed on a stack:
draw the resulting structure (5 Marks)
#include <iostream>
#include <stack>
using namespace std;
int main() {
stack<int> stack;
stack.push(221);
stack.push(220);
stack.push(204);
stack.push(225);

stack.pop();
stack.pop();
while (!stack.empty()) {
cout << ‘ ‘ << stack.top();
stack.pop();
}
}
QUESTION FOUR [15 MARKS]
a) Define Recursion (2 Marks)
b) Name two algorithmic methods that make use of recursion to solve problems (2 Marks)
c) Heapify the following binary tree to make it a maximal heap.


(6 Marks)
d) Using an illustration, define a priority queue abstract data type (2 Marks)
e) Name three operations of a priority queue (3 Marks)

(Visited 201 times, 1 visits today)
Share this:

Written by