henrylin03 / odin-binary-search-tree

Implementing balanced binary search tree (BST) from a sorted array in JavaScript, as part of The Odin Project's "Full Stack JavaScript" course
MIT License
0 stars 0 forks source link

write `preOrder(callback)` method #19

Closed henrylin03 closed 3 months ago

henrylin03 commented 3 months ago

Write preOrder(callback) that also accept a callback as a parameter.

traverse the tree in their respective depth-first order and pass each node to the provided callback. The functions should throw an Error if no callback is given as an argument, like with levelOrder.