A stack is a recursive data structure. Here is a structural definition of a Stack:
- a stack is either empty or it consistes of a top and the rest which is a stack;
- The simplest application of a stack is to reverse a word. You push a given word to stack - letter by letter - and then pop letters from the stack.
- Another application is an "undo" mechanism in text editors; this operation is accomplished by keeping all text changes in a stack.
- Language processing