This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Nicely formatted though it may be, that's a lot of code to ask people to look over. If you have no idea what's going wrong, then the best plan would be to step through it with a debugger. You can generally find problems like this in minutes that way.
Which will always be true. If root is null to begin with (which it is) then you immediately return null, and do no work. You have to change that behavior to something that makes sense (like do some work first, then return null...)
Joined: Mar 07, 2010
gotcha if i remove that line I get NullPointer at AVLApp lines 94 and 87, but that's not even my code that was already given
Well, I think that will help. I think you then need to start tracing what happens with the first, second, third etc... entries. Take a piece of paper and work it out on paper. See where it goes wrong and fix it. I still think your problem is in the put() method. I think you are mixing up what is being stored in the parent, ptr, ptr.left, and ptr.right variables. But working it out on paper should help you out.