Graphs and tries + Bit manipulation basics
Comes up in: DSA
This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.
What it covers
- adjacency list vs matrix
- directed/undirected, weighted
- grids as graphs
- trie structure for prefixes
- binary representation
- AND/OR/XOR/NOT and shifts in JS (32-bit signed for bitwise ops)
- XOR tricks
- checking and setting bits
- bitmasks for small sets
Words you will know
What you will practise
- build adjacency lists from edge lists
- implement Trie
- single-number (E)
- counting-bits (E)
- power-of-two (E)
- subsets via bitmask (M)
Interview questions this answers
- Adjacency list vs matrix: when do you use each?
- What is a trie and what is it good for?