A stack offers four operations. Push adds an item to the top. Pop removes and returns the top item. Peek reads the top without removing it. IsEmpty reports whether anything is left.
Each of these costs O(1). You only ever touch one end, so nothing shifts or searches. Push and pop just adjust the top position and one value. Peek reads a single slot.
That constant cost is the whole appeal. No matter how many items sit below, the top operations stay instant. This is why stacks handle deep call chains and long undo histories without slowing down.
Rewriting in plainer words…
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.