current position:Home>Why do binary search trees always insert into leaf nodes when inserting nodes

Why do binary search trees always insert into leaf nodes when inserting nodes

2022-01-27 00:02:15 CSDN Q & A

Why do binary search trees always insert into leaf nodes when inserting nodes ?
Why do binary search trees always insert into leaf nodes when inserting nodes ?




Refer to the answer 1:

First, find out whether the node to be inserted is in the tree , There is no need to insert , If you are not there, you need to insert .
If binary sort tree is empty , Then the newly inserted node is the new root node ; otherwise , The newly inserted node must be a new leaf node , The insertion position is determined by the position where the search is unsuccessful




Refer to the answer 2:



Refer to the answer 3:

exactly , This should be the rule , There is a norm later , To achieve it , In fact, I have this question ,mark, Ask for an answer .




Refer to the answer 4:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201270002130065.html

Random recommended