• 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

Binary Tree Search

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am in CIS 275 at Devry Univ. for my lab project I am supposed to create a method to search through a binary tree ( if node == quarry return node location, if less than node move left and compare again, if greater than node move right and try again, if not found return null) but I have no idea how to create that in code, can someone please help me? (this project is due Saturday at midnight)

thank you all!

Nessa
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

the implementation of search in binary trees is as simple as the description you have. Assume you have a binary tree which stores ints in nodes:

Then you can implement a method search:



Stefan
[ June 11, 2004: Message edited by: Stefan Krompass ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic