Hash Table
April 26, 2024
1 min
First in first out (FIFO) data structure: first element added will be processed first
Operations:
Most languages support built-in Queue implementation. Just use the built-in function in the interview; no need to reimplement it unless the interviewer asks.
let arr = []arr.push("a")arr.push("b")arr.push("c")arr.push("d")console.log(arr)//(4) ['a', 'b', 'c', 'd']arr.shift()console.log(arr)//(3) ['b', 'c', 'd']
Breadth First Search (BFS): find shortest path in an unweighted graph
In reality:
Last position is connected to the first position
Benefit: reuse space in front of queue
Last in First out (LIFO)
Operations:
- push(value): push new value to the back of the stack- pop(): remove the value from the back of the stack
let arr = []arr.push("a")arr.push("b")arr.push("c")arr.push("d")console.log(arr)arr.pop()console.log(arr)
Quick Links
Legal Stuff
Social Media