Stacks

Lawson Hung
1 min readApr 18, 2020

--

As I study algorithm questions, here’s another one to add to the list. Stacks are pretty straight forward and act a lot like a regular array.

Only caveat is that you can only add and remove from the top of the stack. Namely, you can only push or pop from the top or end of the stack. Last in, first out (LIFO).

Imagine you have a tower of Jenga tiles. If you try to remove from the bottom, the entire tower would collapse. But if you add or remove tiles from the very top, then all will be fine. This, in essence, is how stacks work.

It’s much less complicated than a doubly linked list, which is why I decided to tackle that first to challenge myself. I knew that if I could understand and implement my own doubly linked list, then I would be able to understand stacks as well.

My next plan this week is to research some projects I could possibly contribute to amid the covid-19 virus that has the entire world at a pause.

Stay safe, wash your hands frequently, stay home and keep 6 feet apart if you do go out!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Lawson Hung
Lawson Hung

No responses yet

Write a response