• Post Reply Bookmark Topic Watch Topic
  • New Topic

Tree balance error  RSS feed

 
Isaac Ferguson
Ranch Hand
Posts: 1063
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am trying to get a binary search tree to balance, and I know why it's not working, but I don't know how to fix it.
I balance directly in the insert method.
I put some slash to note where the balancing should happen.
Like this the code is not working:

 
Campbell Ritchie
Marshal
Posts: 56598
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start with some rubber duck programming. Explain to us in small simple words what the algorithm for balancing the tree is. Then explain what algorithm you are using and where you think the error os.

That may enable you to see the solution without our help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!