10 points Question 2 : Errors in Code Below is a function postfirBval that is supposed to read a queue of char tokens an
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
10 points Question 2 : Errors in Code Below is a function postfirBval that is supposed to read a queue of char tokens an
10 points Question 2 : Errors in Code Below is a function postfirBval that is supposed to read a queue of char tokens and evaluates them as postfix notation (assuming there are only has and + operations). If the postfix expression isn't formatted correctly it should print a warning to the user and return -1. Otherwise you should return value produced by the expression. The program should not leak any memory Example: input: 5321 output: 35 Since 5.(3-2) + 1) = 5(6+1)=5.7 – 35 1 int *poutfixEval( Queue *pg Stack pa - createStack(); 2 while in Empty (pq) ) { char aym - dequeue ps): T 11( aym !- + || Bym != 1) push(ps, next): 10 11 elet char y poppa > char x-pop pa: 11 wym pushpa. x+y): ola pushpany > 1 ant nettoppa 20 it Ceptу Крик acan (Poutti expression formatted incorrectlyin" retum - Freequete pa: rotunet
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!