TL;DR a study guide to improve knowledge of data structures
Queues:
- common use cases:
- maintain a ‘queue’ of processes or events
- keeping order of asynchronous actions
- messages
- uses a first in first out method of inserting and removing data
- can be implement as an array or a linked list
example structure github js
Stack:
- common use cases:
- similar use cases as queue but when actions are needed in reversed order
- most recent process executes first
- most recently accessed data
- browser history
- previous action
- previous state
- similar use cases as queue but when actions are needed in reversed order
- uses last in first out method of inserting and removing data
- similar to a queue
example structure github js
Linked List:
- common use cases:
- implementing stacks and queues
- undo/redo, forward/back
- image/video carousel
- next/previous
-
tracking previous and next actions
- fast insertion deletion as the size increases
- operations can be less expensive than arrays
- works well with stacks and queues
- fast to traverse
example structure github js
Binary Search Tree:
- common use cases:
- search
- fast comparisons of data
- fast to search for data
- fast to insert/remove data
- can be unbalanced
example structure github js
code examples from Tyler Hawkins js-data-structures-and-algorithms