An open API service indexing awesome lists of open source software.

https://github.com/ivanbgd/binary-tree-traversals

Binary Tree Traversals
https://github.com/ivanbgd/binary-tree-traversals

binary-tree binary-tree-traversal binary-trees in-order post-order pre-order

Last synced: 3 months ago
JSON representation

Binary Tree Traversals

Awesome Lists containing this project

README

        

# Binary-Tree-Traversals
Contains both recursive and iterative implementations of in-order, pre-order, and post-order binary tree traversals.

The traversal algorithms are the same between the different files. The differences are in passing into and returning from functions.

Trees don't have to be binary search trees to use these traversal algorithms, meaning, they don't have to be in sorted order. These functions will traverse any binary tree. These functions don't do anything with nodes that they visit, but a user can call their function visit() which will do a desired thing with a node. It is noted in the code where it's appropriate to call the function.