File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Binary Search Method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Binary Search Method " Watch "Binary Search Method " New topic
Author

Binary Search Method

Remaan Rem
Ranch Hand

Joined: Mar 04, 2010
Posts: 36
Hi all,

I am trying to write a method: which does the following :
1. traverse the BST looking for a certain element of type T .
2. if found its value get changed with another one.
3. if not, even after completing all the traversal, we add the element to the place we stopped in :
So this is the code I have :


The basic question : is that am not very sure about the recursive call that comes under the second and the third if statments.

Does it really add the element in the specified location.

??
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Remaan Rem wrote:...am not very sure about the recursive call that comes under the second and the third if statments.

Does it really add the element in the specified location.

??

Can you think of a way to test this?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Remaan Rem
Ranch Hand

Joined: Mar 04, 2010
Posts: 36


maybe call it from another class, ir the same class.
and adding print statement? inside of the method
 
wood burning stoves
 
subject: Binary Search Method
 
Similar Threads
Help with expression Tree
Question about TreeNode
add method in a tree class
recursive method to balance a binary tree
how to set a node on expression tree