Question: Data structure 23 Consider using a single integer array S.1 of size n to represent two stacks. Show the initialization of the two stack variables,
Data structure 23

Consider using a single integer array S.1 of size n to represent two stacks. Show the initialization of the two stack variables, topl and top2; and write the codes, which could be pseudo codes, or in C language, for the stack operations as specified below. Assume the array S[.] representing the two stacks being global. void pushl (int topl, int item, int top2) / push/add item to stack 1 void push2 (int topi, int item, int *top2) /push/add item to stack 2 int popl (int *top) int pop2 (int *top) //pop/delete item from stack 1 l/pop/delete item from stack 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
