Infix expression to postfix form using the stack function, Data Structure & Algorithms

Assignment Help:

Q. Convert the following given Infix expression to Postfix form using the stack function: x + y * z + (p * q + r ) * s, Follow general precedence rule and suppose that the expression is legal.                                                                                         

Ans.

The given infix expression is as follows :-

x + y * z + (p * q + r) * s

Symb                Stack                    Postfix Expression x empty  x

+                       +                           x

y                       +                           xy

*                       +*                         xy

z                       +*                         xyz

+                       +                           xyz*+ (          +(         xyz*+

p                       +(                         xyz*+p

*                       +(*                       xyz*+p q       +(*       xyz*+p

+                       +(+                       xyz*+pq*

r                        +(+                       xyz*+pq*r

)                        +                           xyz*+pq*r+

*                       +*                         xyz*+pq*r+

s                        +*                         xyz*+pq*r+s

= xyz*+pq*r+s*+ The postfix expression obtained  is :- xyz*+pq*r+s*+


Related Discussions:- Infix expression to postfix form using the stack function

Pseudocodes, how to write a pseudo code using Kramer''s rule

how to write a pseudo code using Kramer''s rule

Pseudo code, since the gregorian calendar was introduced in 1752,a leap yea...

since the gregorian calendar was introduced in 1752,a leap year occurs every 4 years.you are to write a pseudo code to find out whether a year is a leap year.your progrm should dis

Sorting, Retrieval of information is made simpler when it is stored into so...

Retrieval of information is made simpler when it is stored into some predefined order. Therefore, Sorting is a very important computer application activity. Several sorting algorit

What is quick sort, What is quick sort?   Answer Quick sort is on...

What is quick sort?   Answer Quick sort is one of the fastest sorting algorithm used for sorting a list. A pivot point is chosen. Remaining elements are divided or portio

Tree traversals, There are three kinds of tree traversals, namely, Postorde...

There are three kinds of tree traversals, namely, Postorder , Preorder and Inorder. Preorder traversal: Each of nodes is visited before its children are visited; first the roo

Algorithms, Data array A has data series from 1,000,000 to 1 with step size...

Data array A has data series from 1,000,000 to 1 with step size 1, which is in perfect decreasing order. Data array B has data series from 1 to 1,000,000, which is in random order.

What is binary search, What is binary search?   Binary search is most ...

What is binary search?   Binary search is most useful when list is sorted. In binary search, element present in middle of the list is determined. If key (the number to search)

Explain complexity of an algorithm, Complexity of an Algorithm An algo...

Complexity of an Algorithm An algorithm is a sequence of steps to solve a problem; there may be more than one algorithm to solve a problem. The choice of a particular algorith

Algorithm, give me algorithm of simple interest

give me algorithm of simple interest

Define the term counting - pseudocode, Define the term counting - Pseudocod...

Define the term counting - Pseudocode Counting in 1s is quite simple; use of statement count = count + 1 would enable counting to be done (for example in controlling a repeat

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd