Gallery

Discover apps people built on Collabby by chatting. Run them, then remix to make them yours.

Input Order, Output Order

📚 Even when you add the same things in the same order, the order they come out depends on the “container.” A stack, like a plate pile where you add and remove only from the top, comes out exactly backward. A queue, like a ticket line where people join at the back and leave at the front, comes out in the same order. 🎯 Mixing adding and removing can change the order “to some extent,” but not any way you like — a stack can’t make 「3 · 1 · 2」, and a queue can’t make 「3 · 2 · 1」. 🖨️ At the end, try choosing the right container for print jobs, undo actions, ride lines, and matching brackets. 🧾 Brackets can fool you if you “only count”: even with 2 opening and 2 closing brackets, the pairs can still be wrong—and stacks catch that.

#coding#codingbasics#stack+4
by Anonymous1🍴 0