An array like data structure, whose element follow the LIFO(Last In First Out) rule
- push
- insert element x at the top of stack.
- pop
- removes element from the top of stack.
- peep
- To find n th element from stack.
Operation | Complexity |
---|---|
Pushing an element | O(1) |
Pop an element | O(1) |
Peek an element at top | O(1) |
Search an element | O(n) |
- Singly Linked List