|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
balanced binary trees
hi all
I have a situation in which i maintain a balanced binary tree but the scenario is that I get numbers from 1 to n sequentially as 1,2,3...n as input one by one. So intially i have 1 in binary tree and then 1 and 2 in the tree and so on.. now the problem is that can i find a mapping between the number to be inserterd into the tree and the node in tree at which their might be a possible left rotation.. In my scenario only a single left rotation might be needed when an insertion is performed.. Thanx for any help in advance bye |
|
#2
|
||
|
If your data come in sorted, why are you even putting them in a binary tree?
|
|
#3
|
||||
|
||||
|
AVL Tree
Quote:
Have you considered implementing an AVL Binary tree? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Software Design > balanced binary trees |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|