You are on page 1of 2

Assignment 1

1. Explain how a linked list can be used to store and add two different polynomial expressions,
with diagram. Write the algorithm to add the following two polynomials:

p1= 6x5 + 3x2 + 12

p2= 3x5 + 9x3 + 22

1. A linked queue Q and an AVAIL list is maintained in form of a linked stack, as shown below.
Trace the contents of the memory after the execution of the operations given below and
show the updated table.

INFO LINK

23 56 NULL

24 8 29

25 12 34

26 5 NULL
27 76 30

28 123 31

29 9 33

30 45 23
23 26
31
56 25
32
78 28
33
123 24
34

AVAIL* is at 32, FRONT* is at 27 and REAR* is at 23

i. Insert 546
ii. Delete
iii. Delete
iv. Insert 67

2. What is the value of the postfix expression 6 3 2 4 + – *?


3. Convert the following infix expressions into its equivalent postfix expressions
(A + B ⋀D)/(E – F)+G
4. Consider a stack with the following items: Noida, Delhi, Nasik, Chennai, _,_
Describe the stack as following operations are executed:
i. PUSH(STACK, Jhansi)
ii. POP(STACK)
iii. POP(STACK)
iv. PUSH(STACK, Mumbai)
v. PUSH(STACK, Manali)
vi. POP(STACK)

You might also like