[prev] [index] [next]

Stacks

Insert and delete are called push and pop
  • push(S,V) ... places value V on top of stack S
  • pop(S) ... remove and return top element from S

Stack s = emptyStack();

push(s,10); push(s,15); push(s,7);
x = pop(s); push(s,12); y = pop(s); 

// x == 7  &&  y == 12

Example animation