Data Structures Flashcards
What does the acronym LIFO mean?
Last-in-first-out
What methods are available on a Stack data structure?
push(value), pop(), peek(), and more
What must you do to access the value at an arbitrary point in a stack (not just the “top”)?
pop until you get there, then push everything back if you dont want to mutate the stack
What does the acronym FIFO mean?
First-in-first-out
What methods are available on a Queue data structure?
enqueue(value), dequeue(), peek()
What must you do to access the value at an arbitrary point in a queue (not just the “front”)?
dequeue() until you get there
How are linked lists different from an array?
Linked lists are sequential access (like a queue), not random access (like an array). That means that, in order to go to a specific place in the list, you have to start at the beginning, then jump from node to node until you get there. However, unlike a queue, a linked list doesn’t need to be mutated to scan its contents.
How would you access an arbitrary node in a linked list (not just the “head”)?
.next
What are unit tests?
Why is it important to write unit tests?
What code should be tested with a unit test? What code is not well suited for unit tests?
What is Jest? What are some other popular JavaScript unit testing frameworks?