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

https://github.com/pashaproton/binary-tree

Example of the binary tree in different languages
https://github.com/pashaproton/binary-tree

algorithms binary-tree c cpp education example javascript php python

Last synced: 6 days ago
JSON representation

Example of the binary tree in different languages

Awesome Lists containing this project

README

          

# Binary Tree

There are examples in different languages of binary tree implementation.

[C](./examples/C/binary-tree.c)
| [C++](./examples/C++/binary-tree.cpp)
| [PHP](./examples/PHP/binary-tree.php)
| [Python](./examples/Python/binary-tree.py)
| [JavaScript](./examples/JavaScript/binary-tree.js)

---

Each implementation contains next functions or methods depends on language paradigm:
- **Depth first values** - explore the nodes of the tree, starting from a root node, and it returns a list of node values in the order they were visited.
- **Breath first Values** - visiting all root immediate children before moving on to their children, and so on.
- **Tree Includes** - checks whether a given value exists within a binary tree.
- **Tree Sum** - The "Tree Sum" function calculates the sum of all the values stored in the nodes of a binary tree.
- **Tree Min Value** - finds the minimum value.
- **Max Root to Leaf Path Sum** - calculates the maximum sum that can be obtained by following a path from the root node to any leaf node in a binary tree.

---

### Examples
Each example has **run.sh** file which can be run by `sh run.sh` command. Files structure and names are the same for every language, difference in implementation only.

### Contributing and Issues
- If you see a bug in the code please add new issue [bugs](https://github.com/pashaproton/binary-tree/issues/new) with label **bug**.
- Do not hesisate [add new ideas](https://github.com/pashaproton/binary-tree/issues/new) with label **proposal**.
- Feel free fork the project or add new ideas.