
I am an associate lead developer from Nomura, Mumbai.
Search for a command to run...

I am an associate lead developer from Nomura, Mumbai.
No comments yet. Be the first to comment.
Introduction A bash script is a file having instructions that can also be executed individually on a command line. With scripting, you can automate repetitive tasks. To create a bash script, you can start by creating a file in your favorite editor & ...

Imagine, the switchboard at home every switch is dedicated to some device. When you on/off the switch only that device responds to the signals.

"To understand recursion, one must first understand recursion." - Stephen Hawking

Hello Everyone ๐๐ปโโ๏ธ,
In this article, we will try to understand what are binary trees, as we go along we will be exploring different tree data structures so we must have a basic understanding of the binary tree.
A binary tree is a tree comprising nodes, with each node having at most two other nodes referred to as the left child and the right child of the node.
Each node contains three components data element, pointer to the left child and pointer to the right child, they are recursively defined. If there is no child the pointer points to null.
A data element can be any type of data, while the left and the right pointer point to binary trees on the left and the right side of the node respectively.
The image below represents a binary tree and the node structure if you extract a node element.

class BinaryTree:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
root_node = Node(1)
I hope this article gave you a basic understanding of the binary tree. We will be exploring each type of BT in the later articles.
Thanks for reading ๐๐ปโโ๏ธ
references
https://www.hackerearth.com/practice/data-structures/trees/binary-and-nary-trees/tutorial/