Data Structures Flashcards
What does the acronym LIFO mean?
Last in First Out
What methods are available on a Stack data structure?
Peek Print Pop Push
What must you do to access the value at an arbitrary point in a stack (not just the “top”)?
You’d have to pop items off until you got to the value
then keep the popped items in an array or something
and then push them back on once you got that value
What does the acronym FIFO mean?
First in first out
What methods are available on a Stack data structure?
enqueue,deqeue,peek
What must you do to access the value at an arbitrary point in a stack (not just the “top”)?
you have to dequeue front value until you get to the value you want
How are linked lists different from an array?
A linked list is a collection of objects known as a node where node consists of two parts, i.e., data and address. Array elements store in a contiguous memory location
How would you access an arbitrary node in a linked list (not just the “head”)?
you keep calling next until you get the value you want