0% found this document useful (0 votes)
2 views

Programming Algorithms and Data Structures-exam-Dec-2007

Uploaded by

nicodempaul
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Programming Algorithms and Data Structures-exam-Dec-2007

Uploaded by

nicodempaul
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Uganda Martyrs University

Faculty of Science
Data Structures and Algorithms
BSc Gen, IT II & Dip CS Semester 1 Final Assessment 2007/2008
Date: 12/12/2007 Time 2.00-4.00pm
Instructions:
Answer any 10 (Ten) Questions

1. Define the following terms:


a. Data
b. Data Structure
c. Algorithm.
d. Entity (4Marks)

2. Briefly describe any four Data structures and four data structure operations. (4 Marks)

3. Explain with examples the following terms:


a. Polish Notation
b. Reverse Polish Notation
c. Infix Notation. (4Marks)

4. Translate by inspection and hand the following infix expressions to prefix

a. (K+L) – (Q-R)
b. (A/B)*C (4 Marks)

5. Given the expression Q: ((D*E)/M) – A


Use a stack to transform the above expression from Infix to post fix. (4Marks)

6. Evaluate the following Post fix expression P using a stack. (4Marks)


P: 17 , 10, +, 8, 2, / , -

7. Suppose the marks obtained by students in Programming methodology I are stored in an


array Marks as shown bellow:

MARKS : 50, 60, 90, 45


Apply bubble sort to the Array Marks showing each pass separately. (4Marks)

8. Give the difference between a queue, a priority queue and a dequeue. (4Marks)

9. Explain with examples the tree terms Copies and similar. (4 Marks)

10. Consider the following Queue of Products Where QUEUE is a circular array allocated 7
Memory cells

FRONT: 2
REAR : 4 QUEUE : _____, Sugar, Salt, Rice,______, ________, ________,
Describe the Queue as the following Operations take place
a. One Product is deleted
b. Two products Soap and Oil are added.
c. One product is deleted.
d. One more element is deleted (4Marks)

11. Consider the following deque of characters where DEQUE is a circular array allocated 6
memory locations

LEFT: 3
RIGHT: 3 DEQUE: ______, _______,H,_______,________,_______

Describe the deque as the following operations take Place


a. Three letters A, L, I are added to the Left of the deque.
b. One letter N is added to the Right of the deque.
c. One letter is deleted from the left of the deque. (4 Marks)
d. S is added to the Right.

12. Define and explain with a diagram the following tree terminologies.
a. Edge
b. Path
c. Leaf
d. Branch
e. Level Number
f. Depth of A tree. (4Marks)

You might also like