Stack and Queue are both linear data structure. Both of them can be considered as linked lists with limited reading and writing rights.Therefore, stack and queue’s problems can also be resolved by more powerful list as well.

Queue’s interface is implemented by Linked List in java. Queue can also be implemented by array in 2 ways that are iteratively using one array or using dynamically incremental space’s ArrayList.

Stack’s interface is implemented by Stack class, which is also a list, in java. One of stack’s famous application is used by recursion. When we call a recursion, we will push all programs’ info into stack. When we return from a recursion’s call, we will pop all program’s info from the stack. Here the program’s info is a sub problem.

Problems

40 Implement Queue by Two Stacks

12 Min Stack

423 Valid Parentheses

424 Evaluate Reverse Polish Notation