ovidiuch / illustrated-algorithms

Interactive algorithm visualizations
https://algorithms.now.sh
MIT License
2.77k stars 166 forks source link

bfs: Use set instead of array to track `searched` items #18

Closed mathiasbynens closed 7 years ago

mathiasbynens commented 7 years ago

Set#has runs in O(1) time whereas Array#includes runs in O(n) time.

ovidiuch commented 7 years ago

Glad this could be achieved without compromising brevity. Thanks!

ovidiuch commented 7 years ago

Changes are live.