Get premium membership and access revision papers, questions with answers as well as video lessons.
Got a question or eager to learn? Discover limitless learning on WhatsApp now - Start Now!

Data Structures And Algorithms Question Paper

Data Structures And Algorithms 

Course:Diploma In Business And Information Technology

Institution: Kca University question papers

Exam Year:2012




UNIVERSITY EXAMINATIONS: 2011/2012
EXAMINATION FOR THE DIPLOMA IN BUSINESS INFORMATION
TECHNOLOGY
DBIT 305 DATA STRUCTURES AND ALGORITHMS
DATE: MARCH, 2012 TIME: 1½ HOURS
INSTRUCTIONS: Answer Any Three Questions
QUESTION ONE
a) Show the list that will be formed by traversing the following tree in
Figure 1: Tree
i. Pre-order traversal [3 Marks]
10
9
8
17
5
11
13
14
16
2
ii. In order traversal [3 Marks]
iii. Post order traversal [4 Marks]
b) Convert the following infix expressions into RPN(post fix) notation
i. B*(D-E) [5 Marks]
ii. (A+B)*(C-D) [5 Marks]
QUESTION TWO
a) Explain the term data structure. [2 Marks]
b) Define the following terms with respect to data structures
i. Linked list [2 Marks]
ii. Array [2 Marks]
iii. Stack [2 Marks]
iv. Binary tree [2 Marks]
v. Queue [2 Marks]
c) Define the term algorithm. Give an example [2 Marks]
d) Outline any FOUR applications of algorithms [4 Marks]
QUESTION THREE
a) Explain the term abstract data type (ADT) and give any two examples apart from stack. [4 Marks]
b) Give any two applications of stack ADT [4 Marks]
c) Give any three operations of stack ADTs [6 Marks]
d) Write an algorithm to calculate simple interest of a loan given the principle amount, loan period
(time) and interest rate per annum. [6 Marks]
QUESTION FOUR
a) Using the following expression, A*B+(D-C)
i. Construct a binary tree [4 Marks]
ii. Write the in Preorder traversal for the expression [4 Marks]
iii. Write the post order traversal for the expression [4 Marks]
b) Given a list of elements as 3, 4, 7, 9, 12, 20, 36, 38, 40 write an algorithm that can be used to
search an element in this list. [8 Marks]
3
QUESTION FIVE
a) Write an algorithm for inserting a new node containing integer value 17, between the node
containing integer 11 and the node containing integer 21 in the linked list shown below.
Figure 2: Linked list [8 Marks]
b) For an array based implementation of queue, write algorithms to do the following;
i. Add a value to the queue(enqueue) [3 Marks]
ii. Remove a value from the queue(dequeue) [4 Marks]
Write down the algorithm for heap sort. Use the algorithm to sort the following list:
60, 30, 70, 120, 45, 65, 105, 125, 33 [5 Marks]
9
10
11
21
8
3
0
2






More Question Papers


Popular Exams



Return to Question Papers