part 2: Binary tree in data structure

Hi, this the part 2 of the tree in the data structure, we’re going to talk about binary tree and its famous types.

Definition of binary tree

Binary tree: is one of the most famous tree data structure which each node should have at most 2 ch…


This content originally appeared on DEV Community and was authored by Aya Bouchiha

Hi, this the part 2 of the tree in the data structure, we're going to talk about binary tree and its famous types.

Definition of binary tree

Binary tree: is one of the most famous tree data structure which each node should have at most 2 children (left child and right child), in this type of trees, all nodes contains three items which are data, pointer to left child, pointer to right child.

Types of binary tree

Full Binary tree

  • In this type of trees, all nodes except the leaves have two children

full binary tree in data structure Aya Bouchiha

Perfect Binary tree

  • All internal nodes have exactly two children and all the leaves are at the same level.

perfect binary tree in data structure Aya Bouchiha

Degenerate binary tree

  • In This kind of tree, all nodes have only one child.

degenerate binary tree in data structure

Complete Binary tree

  • Like a full binary tree, All levels are filled, but All the leaves should lean towards the left

complete binartree in data structure Aya Bouchiha

Balanced Binary tree

  • the absolute value of the height difference between the left and the right subtree is smaller than or equal 1. | height(left_sub_tree) - height(right_sub_tree) | <= 1

Balanced binary tree in data structure Aya Bouchiha

Skewed Binary tree

  • All nodes have only one child except the last one (leaf) which hasn't a child. It divided into two types: left skewed binary tree and right skewed binary tree

Skewed binary tree in data structure Aya Bouchiha

References and useful Resources


This content originally appeared on DEV Community and was authored by Aya Bouchiha


Print Share Comment Cite Upload Translate Updates
APA

Aya Bouchiha | Sciencx (2021-06-27T00:18:38+00:00) part 2: Binary tree in data structure. Retrieved from https://www.scien.cx/2021/06/27/part-2-binary-tree-in-data-structure/

MLA
" » part 2: Binary tree in data structure." Aya Bouchiha | Sciencx - Sunday June 27, 2021, https://www.scien.cx/2021/06/27/part-2-binary-tree-in-data-structure/
HARVARD
Aya Bouchiha | Sciencx Sunday June 27, 2021 » part 2: Binary tree in data structure., viewed ,<https://www.scien.cx/2021/06/27/part-2-binary-tree-in-data-structure/>
VANCOUVER
Aya Bouchiha | Sciencx - » part 2: Binary tree in data structure. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/06/27/part-2-binary-tree-in-data-structure/
CHICAGO
" » part 2: Binary tree in data structure." Aya Bouchiha | Sciencx - Accessed . https://www.scien.cx/2021/06/27/part-2-binary-tree-in-data-structure/
IEEE
" » part 2: Binary tree in data structure." Aya Bouchiha | Sciencx [Online]. Available: https://www.scien.cx/2021/06/27/part-2-binary-tree-in-data-structure/. [Accessed: ]
rf:citation
» part 2: Binary tree in data structure | Aya Bouchiha | Sciencx | https://www.scien.cx/2021/06/27/part-2-binary-tree-in-data-structure/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.