So I am learning how to implement BST (creation and traversals).But I’m stuck in understanding insert function in BST.
My doubt is in insert function where we are storing the returned root value.
We are storing it for the first time i.e root of tree but after that we are not storing it.
Can someone help me out ?
For every insert we have to write
root = a.insert(root , value)
but its working for just
a.insert(root , value)
I want to know why it doesn’t throw an error.