Python Program To Implement Binary Search Tree | Program 7 | Min and Max Key

preview_player
Показать описание
In this Python Programming video tutorial you will learn how to implement binary search tree in detail.

Data structure is a way of storing and organising the data so that it can be accessed effectively.
Tree is a non linear data structure contains group of nodes connected via links or edge.

Binary search tree is a special type of binary tree . Here we will use class and object concept to implement binary search tree. In this tutorial we will see how to find minimum and maximum node in tree.


#DataStructures #PythonPrograms #Tree

For more free tutorials on computer programming
Рекомендации по теме
Комментарии
Автор

Via recursion 👇🏻
def min_node(self):
If self.lchild:
self.lchild.min_node()
elif self.lchild is None:
print("min node :", self.key)

pratikmahore
Автор

This will find also by using recursive function na madam

ramakrishna
Автор

Thank you so much for wonderful content.😎👌👌🙌🙌🙌

rohitkamble
Автор

Amulya if we want to get the position of an node while searching, is it possible ? Because In the previous code, we could only know the key is present in the tree or not, but we couldn't know the position of the key

janardhan
Автор

mam we need to apply break statement to terminate the while loop
def min(self):
current=self
while current.left:
current=self.left
break
print('the min is: ', current.root)




def max(self):
current=self
while current.right:
current=self.right
break
print('the max is:', current.root)

nandeesh
Автор

def min_node(self):
current=self
while current.lchild:
current=self.lchild
print("The min value in the tree is", current.key)

def max_node(self):
current=self
while current.rchild:
current=self.rchild
print("The max value in the tree is", current.key)
infinite loop coming is mam

reddyraviteja
Автор

why we didnt write current = self.key except self

prathameshmore
Автор

if self.key is None:
print("Tree is empty")
return
if self.lchild:
node=self.lchild
while node.lchild :
node = node.lchild
print(node.key, "is the min number")
else:
print(self.key, "is the min key")

datafuse
Автор

mam can you please implement it and explain it?please mam if possible, and mam you are also not uploading any videos

zainabbohra
Автор

def minimum(self):
if self.lchild==None:
return self.key
else:
self.lchild.minimum()

def maximum(self):
if self.rchild==None:
return self.key
else:
self.rchild.maximum()

charchitmangal
join shbcf.ru