Via recursion 👇🏻 def min_node(self): If self.lchild: self.lchild.min_node() elif self.lchild is None: print("min node :" ,self.key)
@rohitkamble85152 жыл бұрын
Thank you so much for wonderful content.😎👌👌🙌🙌🙌
@shaimaagoda2954 Жыл бұрын
you are amazing 🤩
@janardhan67522 жыл бұрын
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
@ramakrishna43833 жыл бұрын
This will find also by using recursive function na madam
@AmulsAcademy3 жыл бұрын
Yes 😊
@nandeesh58202 жыл бұрын
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)
@shubhankarsingh40653 жыл бұрын
thanks
@AmulsAcademy3 жыл бұрын
Pleasure 😊
@prathameshmore52622 жыл бұрын
why we didnt write current = self.key except self
@zainabbohra29153 жыл бұрын
mam can you please implement it and explain it?please mam if possible , and mam you are also not uploading any videos
@AmulsAcademy3 жыл бұрын
Will try 😊
@reddyraviteja77023 жыл бұрын
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
@RohitSingh-ko2cz2 жыл бұрын
you need to use current.lchild in 4th line instead of self.lchild becz self value in not changing, same for max_node function.
@nandeesh58202 жыл бұрын
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) we need to apply break statement to terminate te while loop
@selvanm28723 жыл бұрын
👍
@AmulsAcademy3 жыл бұрын
Thank you 😊
@datafuse323 жыл бұрын
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")
@nagendrabommireddi84372 жыл бұрын
what will happen when tree is empty
@umairbijapure75843 жыл бұрын
Is there any Trie structure video??
@charchitmangal2 жыл бұрын
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()