Stack
Understand what is stack.
What is stack?
Stack is a Last In First Out (LIFO) manner and it is built by dynamic array. That means the last element added will be the 1st element to come out first.
Operation | Big-O Time |
---|---|
Push | O(1) |
Pop | O(1) |
Peek / Top | O(1) |