0% found this document useful (0 votes)
59 views1 page

Home Assignment 2 1

1. This document is a home assignment from the Department of Computer Science and Engineering at Motilal Nehru National Institute of Technology Allahabad for the course Data Structures. 2. The assignment contains 6 questions related to converting infix expressions to postfix and prefix expressions, evaluating postfix expressions using a stack, and implementing two stacks in a single array using odd-even and colliding strategies. 3. Students are instructed to scan and submit their handwritten solutions by September 9th, 2020.

Uploaded by

Krishna sah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views1 page

Home Assignment 2 1

1. This document is a home assignment from the Department of Computer Science and Engineering at Motilal Nehru National Institute of Technology Allahabad for the course Data Structures. 2. The assignment contains 6 questions related to converting infix expressions to postfix and prefix expressions, evaluating postfix expressions using a stack, and implementing two stacks in a single array using odd-even and colliding strategies. 3. Students are instructed to scan and submit their handwritten solutions by September 9th, 2020.

Uploaded by

Krishna sah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

eksrhyky usg: jk"Vªh; izkS|ksfxdh laLFkku bykgkckn

प्रयागराज &211004 [Hkkjr]


Motilal Nehru National Institute of Technology Allahabad
Prayagraj-211004 [India]

Department of Computer Science and Engineering


Home Assignment 2
Programme Name: B. Tech. Semester: III

Course Code: CS13101 Course Name: Data Structures

Branch: Computer Science & Engineering

Instructions:
1. This is a handwritten assignment. You need to scan the written assignment and post the solution.
You can keep the hard copy for preparation of examination.
2. Last date of submission is 09/09/2020.

Mapped to
CO number
Q1 Change the following infix expression postfix and prefix expression: 2
(A + B)*C+D/E-F

Q2 Convert the following infix expression to postfix expression. Show the contents of the 2
stack at every step.
(True && False) || !(False || True)

Q3 Use a stack to evaluate the following postfix expression and show the content of the stack 2
after execution of each operation. Assume as if you are using push and pop member
functions of the stack.
AB-CD+E*+ (where A=5, B=3, C=5, D =4, and E=2)

Q4 Evaluate the following postfix expression using a stack and show the contents of stack 2
after execution of each operation:
50,40,+,18, 14,-, *

Q5 Evaluate the following postfix expression using a stack and show the contents of stack 2
after execution of each operation:
TRUE, FALSE, TRUE, FALSE, NOT, OR, TRUE, OR, OR, AND

Q6 Suppose you want to implement two stacks in a single array. Two possibilities are outlined 2
here:
Odd-even strategy: Stack 1 uses locations 0,2,4,... of the array, whereas Stack 2 uses
the array locations 1,3,5,...
Colliding strategy: The two stacks start from the two ends of the array and grow in
opposite directions (towards one another).
Implement both the strategies. Write two sets of initialize, push and pop functions.

Page 1 of 1

You might also like