Data Structures Flashcards
What does the acronym LIFO mean?
last-in-first-out
the last thing pushed onto the stack is the first thing that can be popped out.
What methods are available on a Stack data structure?
print()
pop()
push()
peek()
What must you do to access the value at an arbitrary point in a stack (not just the “top”)?
pop() them off until you can peek() at the point you want
What does the acronym FIFO mean?
first-in-first-out
What methods are available on a Queue data structure?
peek()
print()
dequeue()
enqueue()
What must you do to access the value at an arbitrary point in a queue (not just the “front”)?
dequeue it until we reach the point
How are linked lists different from an array?
you cant access the data in linked list with indexes.
How would you access an arbitrary node in a linked list (not just the “head”)?
You would need to access the next property of each node to move to the next node