Write an algorithm push (s , x) to push an element x into the stack s.
Answers
Answered by
0
The process 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.
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.
Similar questions