Data Flashcards
What does the acronym LIFO mean?
Last In, First Out
What methods are available on a Stack data structure?
.push()- put something on top
.pop()- take something off the top
.peek()- look at whats on top without taking it off
What must you do to access the value at an arbitrary point in a stack (not just the “top”)?
- store the items you ‘pop’ off somewhere
- if you can destroy the stack, just keep using pop
What does the acronym FIFO mean?
First In First Out
What methods are available on a Queue data structure?
.enqueue()- add something to the queue
.dequeue()- remove something from the queue
What must you do to access the value at an arbitrary point in a queue (not just the front)?
Dequeue all the items until you reach the point you’re looking for
How are linked lists different from an array?
Items in a linked list can only be accessed by sequentially traversing the list. Arrays can directly access desired values.
How would you access an arbitrary node in a linked list (not just the “head”)?
Use next node to get where we need to go