Lists: Key Parts

Lists: Key Parts

The Call Stack

When you run a program in any language, whether it's Java, C, Python or Lisp, the computer automatically creates a stack of all the functions currently running. This is called—wait for it—the c...

Efficient Searching

Think back to the last time you needed to find something. Maybe it was your keys, phone, favorite sci fi movie with a terrible premise (and probably a terrible execution, too), or that CD you found...

Inserting and Deleting from Arrays

Inserting into and deleting from lists is kind-of integral to the whole "using lists" thing. If you can't put things in or take things out, you've got a useless data structure on your hands.But bef...

Inserting and Deleting from Linked Lists

If you think inserting and deleting with arrays is easy, just wait till you see what happens in a linked list. Since all the nodes in a linked list are distributed through the computer's memory, yo...

Inserting and Deleting from Stacks

AdditionsIf you need to put clean dishes away in your cupboard, you probably put them at the top of the stack. Try putting them in the middle or the bottom and you risk destroying all your plates.T...

Inserting and Deleting from Queues

In the real world, a queue isn't always the perfect structure that always lets everyone through in the order they entered. Sometimes you get bored standing around for that roller coaster and decide...

Using Stacks for Word Reversal

Writing words backwards can be a great way to write in code, but sometimes it just gets plain confusing. Maybe you're trying to tell your friend "Live star pals," is how you'd describe your friends...

Using Stacks as Queues

Stacks and queues might sound about as different as Hamilton and Burr, and…they are. Stacks are last in, first out (LIFO) structures, and queues are first in, first out (FIFO). Stacks insert and...