laurentknauss / binary_tree_data_structure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

binary_tree_data_structure

A binary tree is a vertical kind of data structure. It is called "binary" because each node in the tree can have at most two children, referred to as the left child and the right child.
These children are positioned vertically below their parent node. Hence, the binary tree structure expands downward vertically as nodes are added.

To visualize a binary tree, you can imagine it as an inverted tree where the root node is at the top and the branches (edges) extend downward.
Each node can have zero, one, or two child nodes, forming a hierarchical structure.

Here's an example of a binary tree:
BinaryTree

In this figure, the root node is 5 and it has two children : 3 and 8.

The left child of 5 , which is 3, has it own two children , 1 and 4 .
The right child of 5, which is 8, has its own two children, 7 and 9 .

The codebase in this repo, will show you how to create a binary tree and how to traverse it in order to print all of its elements as proof that Go can be used for creating a tree data structure. Therefore, it will not implement the full functionality of a binary tree, which also includes deleting a tree node and balancing a tree.

About


Languages

Language:Go 100.0%