• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Binary Search Method

 
Remaan Rem
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Remaan Rem
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


maybe call it from another class, ir the same class.
and adding print statement? inside of the method
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic