A stack hands back the last thing you added. A queue hands back the first. Both do it in O(1) — the structure keeps the order for you.
Stacks and queues are not new memory layouts — they are rules about which end you may touch. A stack enforces LIFO: Last In, First Out. You add (push) and remove (pop) only from the top, like a pile of plates. A queue enforces FIFO: First In, First Out. Items join at the back (enqueue) and leave from the front (dequeue), like a checkout line. Every operation is O(1) — the structure guarantees the ordering automatically.
On the left, the stack grows upward (LIFO). On the right, the queue runs left to right (FIFO). Drag to orbit, scroll to zoom, then press an operation.
Every single operation is O(1) — that is the whole point of restricting access to one end.
All operations constant time. The order items leave is the only difference.