Without using the ready stack library & c++ & using array & explain the code plz Apply the Stack Applications algorithm
Posted: Sat Nov 27, 2021 10:36 am
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*/
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*/