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

Practice Problems

The document provides practice problems about data structures including: 1) Explaining infix, prefix, and postfix expressions and converting between them. 2) Drawing stack structures for adding and deleting letters from an empty stack. 3) Converting between prefix and infix expressions. 4) Evaluating postfix expressions with and without using a stack.

Uploaded by

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

Practice Problems

The document provides practice problems about data structures including: 1) Explaining infix, prefix, and postfix expressions and converting between them. 2) Drawing stack structures for adding and deleting letters from an empty stack. 3) Converting between prefix and infix expressions. 4) Evaluating postfix expressions with and without using a stack.

Uploaded by

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

CSD102- Data Structure

Practice Problems
1. Explain the terms infix expression, prefix expression, and postfix expression.
Convert the following infix expressions to their postfix equivalents:
(a) A – B + C
(b) A * B + C / D
(c) (A – B ) + C * D / E – C
(d) (A * B) + (C / D) – ( D + E)
(e) ((A – B) + D / ((E + F) * G))
(f) ( A – 2 * (B + C) / D * E) + F
(g) 14 / 7 * 3 – 4 + 9 / 2

2. Convert the following infix expressions to their postfix equivalents:


(a) A – B + C
(b) A * B + C / D
(c) (A – B ) + C * D / E – C
(d) (A * B) + (C / D) – ( D + E)
(e) ((A – B) + D / ((E + F) * G))
(f) ( A – 2 * (B + C) / D * E) + F
(g) 14 / 7 * 3 – 4 + 9 / 2

3. Draw the stack structure in each case when the following operations are performed on an
empty stack:

(a) Add A, B, C, D, E, F (b) Delete two letters

(c) Add G (d) Add H (e) Delete four letters (f) Add I

4. Give the infix expression of the following prefix expressions.

(a) * – + A B C D

(b) + – a * B C D

5. Evaluate the following postfix expression: 9 8 7 + * 3 /.


6. Evaluate the following postfix expression using a stack: 9 8 7 + * 3 /.

You might also like