Address
304 North Cardinal St.
Dorchester Center, MA 02124
Work Hours
Monday to Friday: 7AM - 7PM
Weekend: 10AM - 5PM
Address
304 North Cardinal St.
Dorchester Center, MA 02124
Work Hours
Monday to Friday: 7AM - 7PM
Weekend: 10AM - 5PM
This article assumes that you have some basic knowledge of trees that’s why it is made for experienced professionals.
Just YOU and TREES here. Enjoy…
Quick Recap – A tree data structure is a hierarchical data structure consisting of nodes connected by edges, where each node has zero or more child nodes, with one designated as the root node. Trees are widely used for representing hierarchical relationships and organizing data & searching efficiently.
Points to Remember –
Applications –
Tree Implementation(in Python) :
class TreeNode:
def __init__(self, data, left=None, right= None):
self.data = data
self.left = left
self.right = right
# To check if node is leaf
def is_leaf(self):
return self.left == None and self.right == None
# Create Tree
root = TreeNode(20)
root.left = TreeNode(10)
root.right = TreeNode(30)
# Check if particular node is Leaf
print(root.left.is_leaf())
Here’s a Challenge for YOU. if you can make following functions in a 2 hour then you can consider yourself knowledgable in Tree Data Structure.
And That’s it. Now you need to invest 3 hours in above questions.