Add binary tree content (#6887)

* content for binary tree

* content for binary tree
pull/6890/head
Reza Mobaraki 3 months ago committed by GitHub
parent 6101f01055
commit 12fd9287c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      src/data/roadmaps/datastructures-and-algorithms/content/107-tree-data-structure/100-binary-trees.md
  2. 7
      src/data/roadmaps/datastructures-and-algorithms/content/107-tree-data-structure/101-binary-search-trees.md
  3. 6
      src/data/roadmaps/datastructures-and-algorithms/content/107-tree-data-structure/104-tree-traversal/index.md

@ -1,3 +1,8 @@
# Binary Trees
A **Binary Tree** is a type of tree data structure in which each node has at most two children, referred to as the left child and the right child. This distinguishes it from trees in which nodes can have any number of children. A binary tree is further classified as a strictly binary tree if every non-leaf node in the tree has non-empty left and right child nodes. A binary tree is complete if all levels of the tree, except possibly the last, are fully filled, and all nodes are as left-justified as possible. Multiple algorithms and functions employ binary trees due to their suitable properties for mathematical operations and data organization.
A **Binary Tree** is a type of tree data structure in which each node has at most two children, referred to as the left child and the right child. This distinguishes it from trees in which nodes can have any number of children. A binary tree is further classified as a strictly binary tree if every non-leaf node in the tree has non-empty left and right child nodes. A binary tree is complete if all levels of the tree, except possibly the last, are fully filled, and all nodes are as left-justified as possible. Multiple algorithms and functions employ binary trees due to their suitable properties for mathematical operations and data organization.
Learn more from the following links:
- [@video@Binary Tree](https://youtu.be/4r_XR9fUPhQ?si=PBsRjix_Z9kVHgMM)
- [@article@Binary Tree](https://www.w3schools.com/dsa/dsa_data_binarytrees.php)

@ -1,3 +1,8 @@
# Binary Search Trees
A **Binary Search Tree** (BST) is a type of binary tree data structure where each node carries a unique key (a value), and each key/node has up to two referenced sub-trees, the left and right child. The key feature of a BST is that every node on the right subtree must have a value greater than its parent node, while every node on the left subtree must have a value less than its parent node. This property must be true for all the nodes, not just the root. Due to this property, searching, insertion, and removal of a node in a BST perform quite fast, and the operations can be done in O(log n) time complexity, making it suitable for data-intensive operations.
A **Binary Search Tree** (BST) is a type of binary tree data structure where each node carries a unique key (a value), and each key/node has up to two referenced sub-trees, the left and right child. The key feature of a BST is that every node on the right subtree must have a value greater than its parent node, while every node on the left subtree must have a value less than its parent node. This property must be true for all the nodes, not just the root. Due to this property, searching, insertion, and removal of a node in a BST perform quite fast, and the operations can be done in O(log n) time complexity, making it suitable for data-intensive operations.
Learn more from the following links:
- [@video@Binary Search Tree Part-1](https://youtu.be/lFq5mYUWEBk?si=GKRm1O278NCetnry)
- [@video@Binary Search Tree Part-2](https://youtu.be/JnrbMQyGLiU?si=1pfKn2akKXWLshY6)

@ -1,3 +1,7 @@
# Tree Traversal
Tree Traversal is a method of visiting all the nodes in a tree data structure. There are three main types of tree traversal, these include Preorder, Inorder, and Postorder. Preorder traversal visits the current node before its child nodes, Inorder traversal visits the left child, then the parent and right child, and Postorder traversal visits the children before their respective parents. There's also a level order traversal which visits nodes level by level. Depth First Search (DFS) and Breadth First Search (BFS) are two popular algorithms used for tree traversal. DFS involves exhaustive searches of nodes by going forward if possible and if it is not possible then by going back. BFS starts traversal from the root node and visits nodes in a level by level manner.
Tree Traversal is a method of visiting all the nodes in a tree data structure. There are three main types of tree traversal, these include Preorder, Inorder, and Postorder. Preorder traversal visits the current node before its child nodes, Inorder traversal visits the left child, then the parent and right child, and Postorder traversal visits the children before their respective parents. There's also a level order traversal which visits nodes level by level. Depth First Search (DFS) and Breadth First Search (BFS) are two popular algorithms used for tree traversal. DFS involves exhaustive searches of nodes by going forward if possible and if it is not possible then by going back. BFS starts traversal from the root node and visits nodes in a level by level manner.
Learn more from the following links:
- [@video@Tree Traversal pre-order, in-order, post-order](https://youtu.be/lFq5mYUWEBk?si=GKRm1O278NCetnry)

Loading…
Cancel
Save