Lab6-StackProblems-sol - - A - ( / - B + C Resulting...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science I – Spring 2011 Recitation #6: Stack Applications – Infix/Postfix (Solutions) Convert the following INFIX expressions into POSTFIX expressions using stacks (as shown in class). Show the contents of the stack at the indicated points (A,B, and C) in the infix expression. NOTE: There is a SPECIFIC way that these conversion problems are tested. The TA will do problem 1 for you and show you what is expected of you and what you can expect on a test. You should keep a “WORKING” stack that you use to solve the problem. Then you will copy the contents of this working stack, when appropriate, into the given stacks (stacks A, B, and C). A B C 1) 44 – 15 / ( 9 - 3 * 2 ) + 12
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: - A - ( / - B + C Resulting POSTFIX expression : 44 15 9 3 2 * - / - 12 + Answer: 51 A B C 2) 12 * ( 8 - 7 + 1 ) - ( 4 + 6 ) / 2 ( * A * B / - C Resulting POSTFIX expression : 12 8 7 - 1 + * 4 6 + 2 / - Answer: 19 A B C 3) ( 3 + 8 + 5 - 10 ) / 3 + 4 + 5 - 7 + ( A B + C Resulting POSTFIX expression : 3 8 + 5 + 10 3 / 4 + 5 + 7 - Answer: 4 A B C 4) 14 - ( 6 - 10 ) - 10 A - ( - B- C Resulting POSTFIX expression : 14 6 10 - - 10 - Answer: 8 A B C 5) 16 - ( 8 + ( 10 - 7 + 3 ) * 2 - 10 ) / ( ( 4 - 2 ) * 3 - 1 ) ( + ( - A * + ( - B * ( / - C Resulting POSTFIX expression : 16 8 10 7 3 + 2 * + 10 4 2 3 * 1 - / - Answer: 14...
View Full Document

This note was uploaded on 09/21/2011 for the course COP 3330 taught by Professor Staff during the Spring '08 term at University of Central Florida.

Page1 / 2

Lab6-StackProblems-sol - - A - ( / - B + C Resulting...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online