Created
April 12, 2022 09:24
-
-
Save oreillyross/1b0a7a1540af3b9ce458ed597ce4afed to your computer and use it in GitHub Desktop.
for...of takes an iterable, so iterating left and right nodes in a BFS binary tree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (const child of [node.left, node.right]) { | |
if (child) queue.push(child); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment