VUsolutions Transferred to AchiKhasi.com

From December 2011, this blog www.VUsolutions.blogspot.com is transferred to http://achikhasi.com/vu/ . So, you may visit http://achikhasi.com/vu/ for latest study related help.

Back to home VUsolutions

VUsolutions Fans Club [join us for MORE solutions]

VUsolutions on Facebook

cs301 solution

Friday, May 07, 2010 Posted In Edit This
7 2↑ 4 3 2↑*+18 3/-
7 2↑ 4 3 2↑*+18 3/-

Input op1 op2 value Stack
7 7
2 2
7
↑ 7 2 49 49
4 7 2 49 4
49
3 7 2 49 3
4
49
2 7 2 49 2
3
4
49
↑ 3 2 9 9
4
49
* 4 9 36 36
45
+ 49 36 85 85
18 49 36 85 18
85
3 49 36 85 3
18
85
/ 18 3 6 6
85
- 85 6 79 79
79






Q.2
Convert the following infix expression into postfix expression using stack, show your evaluation in the following tabular form.




a) 4↑ 2 + (5 * 4) ↑ 2 – 18 / 3 5 marks
Symbol Postfix Stack
4 4
↑ 4 ↑
2 42 ↑
+ 42↑ +
( 42↑ +(
5 42↑5 +(
* 42↑5 +(*
4 42↑54 +(*
) 42↑54* +
↑ 42↑54* +↑
2 42↑54*2
- 42↑54*2↑+ -
18 42↑54*2↑+18 -
/ 42↑54*2↑+18 -/
3 42↑54*2↑+183 -/
42↑54*2↑+183/-

b) 7+(5-2)+(2 *1)-(5/2) 5 marks
Symbol Postfix Stack
7 7
+ 7 +
( 7 +(
5 75 +(
- 75 +(-
2 752 +(-
) 752- +(-
+ 752-+ +
( 752-+ +(
2 752-+2 +(
* 752-+2 +(*
1 752-+21 +(*
) 752-+21* +
- 752-+21*+ -
( 752-+21*+ -(
5 752-+21*+5 -(/
/ 752-+21*+5 -(/
2 752-+21*+52 -(/
) 752-+21*+52/ -

752-+21*+52/-


..............


Q.2
Convert the following infix expression into postfix expression using stack, show your
evaluation in the following tabular form.
a) 4 2 + (5 * 4) 2 – 18 / 3
b) 7+(5-2)+(2 *1)-(5/2)
Symbol Postfix Stack
7 7
+ 7 +
( 7 +(
5 7 5 +(
- 7 5 +(-
2 7 5 2 +
) 7 5 2 -
+ 7 5 2 - + +
( 7 5 2 - + +(
2 7 5 2 - + 2 +(
* 7 5 2 - + 2 +(*
Symbol Postfix Stack
4 4
4
2 4 2
+ 4 2 +
( 4 2 +(
5 4 2 5 +(
* 4 2 5 +(*
4 4 2 5 4 +(*
) 4 2 5 4 * +
4 2 5 4 * +
2 4 2 5 4 * 2 +
- 4 2 5 4 * 2 + -
18 4 2 5 4 * 2 + 18 -
/ 4 2 5 4 * 2 + 18 - /
3 4 2 5 4 * 2 + 18 3 / -
4 2 5 4 * 2 + 18 3 / -
1 7 5 2 - + 2 1 +(*
) 7 5 2 - + 2 1
- 7 5 2 - + 2 1 * + -
( 7 5 2 - + 2 1 * + -(
5 7 5 2 - + 2 1 * + 5 -(
/ 7 5 2 - + 2 1 * + 5 -(/
2 7 5 2 - + 2 1 * + 5 2 -(/
) 7 5 2 - + 2 1 * + 5 2 / -
7 5 2 - + 2 1 * + 5 2 / -


Back to home VUsolutions

Shaadi.com: Just create ur account & find ur partner or EARN money, its reall & EASY

VUsolutions Followers (Join NOW and Get Extra Benefits)

Install LATEST toolbar having lot of features - GET solutions on Desktop

toolbar powered by Conduit
Caliplus 300x250 NoFlam VitoLiv 468x60 GlucoLo