Without using the ready stack library & c++ & using array & explain the code plz Apply the Stack Applications algorithm

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Without using the ready stack library & c++ & using array & explain the code plz Apply the Stack Applications algorithm

Post by answerhappygod »

Without using the ready stack library & c++ &
using array & explain the code plz
Apply the Stack Applications algorithms in
C++.
• You have to implement the stack using the static array
.
• You have to create a project for each algorithm.
- The input for the first project is an infix
expression. While the output is the equivalent postfix
expression.
-The input for the second project is a postfix expression. While
the output is the evaluation result.
• Add a screenshot of the output for each project.
opstk= the empty stack;
while (not end of input)
{
symb=next input character;
if (symb is an operand)
add symb to the postfix string
else
{
while (!empty()&&prcd(stacktop(), symb))
{
topsym=pop();
add topsymbto the postfix string;
} /*end while*/
if (empty() II symb != ‘)’)
push(symb);
else /* pop the open parenthesis and discard it */
topsymb= pop();
} /* end else*/
} /* end while*/
/*output any remaining operators*/
while (!empty())
{
topsymb=pop();
add topsymb to the postfix string;
} /* end while*/
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply