Question: the question will be given in 4 parts a , b , c and d , and will be shown in the first picture ,

the question will be given in 4 parts a , b , c and d , and will be shown in the first picture , and the code ( the source ) will be given in the next last 4 pictures

the question will be given in 4 parts a , b ,

c and d , and will be shown in the first picture

, and the code ( the source ) will be given inthe next last 4 pictures 3. Execute the programs (Program 8.15 and

Program 8.16) given below for array- based stack and observe the output

3. Execute the programs (Program 8.15 and Program 8.16) given below for array- based stack and observe the output when the following operations are performed: a) push a, push b, push c, push d, push a, push b, push c, push d, push e, push d, and push f. b) push a, push b, pop, push c, push d, pop, push a, and push b c) push a, push b, pop, push c, push d, pop, push a, pop, pop, pop, and pop d) Repeat the operations for a stack implemented with link list. 1 7/Program 8.15 array based stack const int size = 10; 3 class stack private : // data declaration int top; char data[size]; 8 9 10 public : // function declaration MODULE 8: STACK 11 12 13 14 15 16 17 18 void createStack(); void push(); // insert operation void pop(); // delete operation int stackTop(); // get top value bool isFull(); // check it stack is full bool isEmpty(); // check if stack is empty 2 NNNNNNNN 19 void stack:: createStack(); / top = -1; 21 22 23 bool stack::isFull() { 24 return bool( top == size-1 ); 25 } 26 27 bool stack::isEmpty() { 28 return bool( Top == -1); 29] 30 31 void stack::push() { 32 char newitem; 33 34 cout > newitem; 36 if (isFull()) // check whether stack is full 37 cout > item; newnode = new (stack); 31 if( newnode == NULL) cout data = item; 36 newnode->next = head, 37 head newnode; 38 1// end if 39 l/end push operation 40 41 void stack::pop() { 42 nodeStack delnode; 43 if (isEmpty()) cout data next; delete (delnode); 50 // end else 51 } // end pop 52 53 int stack::stackTop() { 54 if (isEmpty()) cout data; MODULE 8: STACK 56 58

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!