Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
Binary Search Tree Freezes
Angela Truce
Ranch Hand
Posts: 47
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi,
I've modified so that it loops but when i try to execute it, it doesnt do anything (my
applet
wont load to show the tree).
Can anyone see why?
code:
public void add(Integer integer) { BTNode temp = new BTNode(integer,null,null,null); boolean cont=true; if(root == null) { root=temp; } else { while (cont) { if(integer.compareTo(root.getElement()) < 0 ||root.getElement()==integer) { if (root.getLeftChild()!=null) { root=root.getLeftChild(); } else { root.setLeftChild(temp); cont = false; } } else { if (root.getRightChild()!=null) { root=root.getRightChild(); } else { root.setRightChild(temp); cont = false; } } } } }
thanks.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
how far does the apple fall - BinaryTrees
How do I convert an object into a string?
cannot make static reference to non-static Integer
Binary Search Tree Freezes
Binary Search Tree
More...