Get premium membership and access revision papers, questions with answers as well as video lessons.

Dit 307: Data Structures &Amp; Algorithms Question Paper

Dit 307: Data Structures &Amp; Algorithms 

Course:Diploma In Information Technology

Institution: Kca University question papers

Exam Year:2012



INSTRUCTIONS:
1. Answer Any THREE Questions.
2. All Questions Carry EQUAL Marks.
3. Time Allowed is 1hr 30mins.

Question One
a) Explain the importance of abstraction as a programming strategy. [4 marks]

b) Explain the meaning of the following terminologies as used in data structures and algorithms. [12 marks]

i. Abstract data type
ii. Algorithms
iii. Data structures
iv. Constructors
v. Destructors
vi. Post conditions

c) Outline any four characteristics of a good program. [4 marks]

Question Two
a) You need to compute the gross salaries of three employees John, Peter and James. The gross salary is computed by multiplying the working hours by rate of pay. You are therefore required to do the following:
i. Write down an algorithm that will calculate gross salary for each employee. [4 marks]
ii. Using salary as an abstract data type (ADT) write a program in c++ to implement algorithms in (i) [8 marks]

b) Describe the following data structure: [8 marks]
i. Stack
ii. Queue
iii. Binary tree
iv. Linked list

Question Three
a) Describe the following operations in a stack: [4 marks]
i. Pop
ii. Push
iii. Constructor
iv. Empty

b) Write an algorithm to insert 5 integers into the stack and then remove the elements. [6 marks]

c) Write a program to implement the above algorithm in c++ and store elements 0.04, 0.03, 0.05, 76.55, 23.65 using arrays and then return the top element as well as the size of the stack. [8 marks]

d) Explain any two application of stacks. [2 marks]

Question Four
a) Describe the term big O with regard to algorithm efficiency. [4 marks]

b) Briefly explain the following terms with respect to algorithm complexity: [6 marks]
i. Space complexity
ii. Time complexity

c) Given seven (7) elements in an array, outline the algorithm for linear search to locate element x. [4 marks]

d) Write down an algorithm to search an element in a given list using binary search. [6 marks]

Question Five
a) Write down an algorithm to store eight integers in a singly linked list. [4 marks]

b) Write the code to create a doubly linked list in c++ [6 marks]

c) Write an algorithm to sort a list using the following sort algorithms:
i. Merge sort [6 marks]
ii. Heap sort [4 marks]






More Question Papers


Popular Exams



Return to Question Papers