83,892 views
17 votes
17 votes
What variable(s) is/are used in stack to keep track the position where a new item to be inserted or an item to be deleted from the stack

User Yvanne
by
1.9k points

1 Answer

14 votes
14 votes

Answer:

Hence the answer is top and peek.

Step-by-step explanation:

In a stack, we insert and delete an item from the top of the stack. So we use variables top, peek to stay track of the position.

The insertion operation is understood as push and deletion operation is understood as entering stack.

Hence the answer is top and peek.

What variable(s) is/are used in stack to keep track the position where a new item-example-1
User Hai Hack
by
3.3k points