Write down the Postfix notation of the following expression: 9 - 3 + 2 * ( 3 * 4 - 3 ) / 4 + 2 * 1 | PU | Past Paper 2017

UNIVERSITY OF THE PUNJAB

Fourth Semester 2017

Examination: B.S. 4 Years Programme 

Paper: Data Structure and Algorithm

Course Code: IT-207 / IT-22408

Short Questions

a) Write down the Postfix notation of the following expression:

9 - 3 + 2 * ( 3 * 4 - 3 ) / 4 + 2 * 1

Solution:

9 - 3 + 2 * ( 3 * 4 - 3 ) / 4 + 2 * 1
9 - 3 + 2 * ( 34* - 3 ) / 4 + 2 * 1
9 - 3 + 2 * 34* 3- / 4 + 2 * 1
9 - 3 + 234* 3-* / 4 + 2 * 1
9 - 3 + 234* 3-*4/ + 2 * 1
9 - 3 + 234* 3-*4/ + 21*
93- + 234* 3-*4/ + 21*
93-234* 3-*4/+ + 21*
93-234* 3-*4/+21*+

Ans: 93-234* 3-*4/+21*+


Previous Post:
Quick Sort In Data Structure Using C++


Comments

  1. Thanks a lot! This is really helpful!





    ReplyDelete
    Replies
    1. Please subscribe and share the blog if you find it helpful.

      Delete

Post a Comment