Data Structures Flashcards
What does the acronym LIFO mean?
Last In First Out
What methods are available on a Stack data structure?
.push() .pop() .peek()
What must you do to access the value at an arbitrary point in a stack (not just the “top”)?
Keep popping the top of the stack until you get to the desired point
What does the acronym FIFO mean?
First In First Out
What methods are available on a Queue data structure?
.dequeue() .enqueue() .peek()
What must you do to access the value at an arbitrary point in a queue (not just the “front”)?
You dequeue the front of the queue until you get to the desired point
How are linked lists different from an array?
Nodes cannot be accessed by index
How would you access an arbitrary node in a linked list (not just the “head”)?
You need to keep calling .next on the list until you get the node you want