Saved Bookmarks
| 1. |
Write an algorithm push (s , x) to push an element x into the stack s. |
|
Answer» cess of putting a new data element onto stack is known as a Push OPERATION. Push operation involves a series of STEPS −Checks if the stack is full.If the stack is full, print an ERROR saying “Stack is Full! Overflow Condition” and RETURN -1.If the stack is not full, incrementstop to point next empty space.Adds data element to the stack LOCATION, where top is pointing.Returns success. |
|