Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Q. Write down an algorithm to convert an infix expression into the postfix expression.    

Ans.

Algorithm to convert infix expression to post fix expression is given as follows.

1. opstk = the empty stack;

2. while (not end of input) {

3. symb = next input character;

4. if (symb is an operand) add symb to postfix string

5. else {

6. while (!empty (opstk) and prcd (top (opstk), symb)>0){

7. topsymb = pop(opstk);

8. add topsymb to the postfix string; }/*end while*/

9. if (empty (opstk) || symb! = ')' ) push (opstk, symb); else /*pop the open parenthesis and discard it */

topsymb = pop(opstk);

} /* end else */

}/* end while */

/* output any remaining operator */

10.while (!empty (opstk)){

11. top symb = pop (opstk);

12. add topsymb to the postfix string;

} /* end while * /

/*output any remaining operator*/

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9504389

Have any Question?


Related Questions in Computer Engineering

Taskstudents are required to do the following tasks for

Task Students are required to do the following tasks for write report by answering all the questions at the end of case study: Task a: Answering all the questions at the end of case study. Task b: Student is required to ...

Design a moore machine where the output y goes high 1 when

Design a Moore machine where the output Y goes high (=1) when the last four bits of the input X were 1110: 4th to last bit seen = 1 3rd to last bit seen = 1 2nd to last bit seen = 1 Last bit seen = 0 Your machine must be ...

Compare remote authentication dial-in user service radius

Compare Remote Authentication Dial-In User Service (RADIUS) and Terminal Access Controller Access-Control System Plus (TACACS+).

Question suppose you are starting work on a project for an

Question : Suppose you are starting work on a project for an organization that has never used any modeling techniques or tools in designing a system. (Yes, it is hard to imagine, but it does exist.) Your manager is reluc ...

Question suppose you are considering an improvement to a

Question : Suppose you are considering an improvement to a computer program. The improvement is applicable only to a fraction 35% of the program and the speedup of the improved fraction is 15. What is the overall speedup ...

Question suppose a binary tree t has 10 nodes which are

Question : Suppose a binary tree T has 10 nodes which are labeled 0,1,2,...,9. We ran the inorder and postorder traversals on the tree and the nodes were processed in the following order: inorder traversal: 0,3,1,2,9,4,6 ...

Can someone help solve this problem in lisp-programming

Can someone help solve this problem in Lisp-Programming language? More specifically in DrRacket. Exercise: A professor keeps the quiz grades of a student in a non-empty vector of non-negative numbers. Write a function th ...

Please discuss the design principles that guide the authors

Please discuss the design principles that guide the authors of instruction sets in making the right balance. Provide examples of application of each of the three design principles while designing instruction sets.

Any help will be appreciatedscenarionbspyou are a

Any help will be appreciated Scenario: You are a networking and communications consultant working for HoustonComm Services, Inc, further referred to as HCS. HCS is a company providing technology consulting services to st ...

For a small computer design with 8-instructions suppose the

For a small computer design with 8-instructions. Suppose the processor is modified such that it can is 21-bit processor and can address 2^16 Memory locations: 1. What is the word size? 2. How that will affect the size of ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As