eat
tea
tan
ate
nat
bat
[0][1][2][3][4][5]
Brute force · pairwise
▸1given words2for i ← 0 to n − 1 (if word i not yet grouped):3 start group with words[i]4 for j ← i + 1 to n − 1:5 if sorted(words[i]) == sorted(words[j]): add words[j]6return all groups
state
- n6