Vous êtes sur la page 1sur 2

Homework

Course code Course title Note: 1. All questions are compulsory 2. No cheating or copying is allowed. 3. The homework submission would be followed by a viva on which the marks of the homework would depend. Maximum marks : 20 Questions : 1. Consider the following stack, where STACK is allocated N = 6 memory cells : STACK: AAA, DDD, EEE, FFF, GGG, __________ Describe the stack as the following operations take place : a) PUSH(STACK,KKK) b) POP(STACK,ITEM) c) PUSH(STACK,LLL) d) PUSH(STACK,SSS) e) POP(STACK,ITEM)
f) PUSH(STACK,TTT)

: :

CAP204 Fundamentals of Data Structures

[2]

2. Convert the following expressions in Infix notations into postfix notations using stack: a) ((A+B)/D)^((E-F)*G) b) (A-B)/((D+E)*F)

Note : ^ is for power

[5]

3. Consider the following expressions in Postfix, use the stack to evaluate them. a) 5,3,+,2,*,6,9,7,-,/,b) 3,5,+,6,4,-,*,4,1,-,2,^,+
c) 3,1,+,2,^,7,4,-,2,*,+,5,-

[5]

4. Consider the following queue where QUEUE is allocated 6 memory celles:

FRONT=2, RIGHT=5, QUEUE:____,LONDON,BERLIN,ROME,PARIS,______

Describe the queue, including FRONT and REAR, as the following operations take place: a) ATHENS is added, b) Two cities are deleted. c) MADRID is added. d) MOSCOW is added. e) Three cities are deleted and [5]

5. Suppose a queue is maintained by a circular array queue with N=12 memory cells. Find the number of elements in QUEUE if : a. FRONT=4, REAR=8 b. FRONT=10,REAR=3 c. FRONT=5,REAR=6 and the two elements are deleletd. [3]

Vous aimerez peut-être aussi