|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
IntroductionToday I will show you how to search data using the binary tree algorithm.It may not be the fastest algorithm you've ever seen but it's so easy to use and better than using .NET's simple structures.
CodeFirst we need to figure out how we sort items in our tree. BinaryIndex index = new BinaryIndex( new TestComparer(), true );
index.Add( 10 ); index.Add( 2 ); index.Add( 21 ); To search the tree just call the Search method which will return an ArrayList object of the results: ArrayList results = index.Search( 4 );
|
|||||||||||||||||||||||||||||||||||||||||||||||||||