I have created a tree ( contains name and age)
now i have to create a method that takes the name as an input searches the tree and returns name and age.
i am not sure how to start this taks.
Thank you for time and ideas.
Printable View
I have created a tree ( contains name and age)
now i have to create a method that takes the name as an input searches the tree and returns name and age.
i am not sure how to start this taks.
Thank you for time and ideas.
wikopedia can have have good articles on computer science topics. Their article on searhing binary trees has as much info as you will likely need.
Binary search tree - Wikipedia, the free encyclopedia
They even have java code.
Without presenting your code, it will be difficult to give anything but vague advice. For example, are you using your own tree implementation or one in Java's standard library?
First off, is the tree a binary tree? Is the tree sorted by name (since you want to search by name)?