Member Avatar for arcticM

hey everyone..
I need to find an algorithm that runs a search in a rundomly made binary tree that holds the keys 1 to n and looks for a subdomain..let's say I'm looking for nodes between the keys 4-30.
I can't find any example codes on the web or explanations..even in Corman's book!! :S
I need to find the number of nodes the algorithm goes through in the worst, average and best case performance.
I'm really a beginner in all of this and COMPLETLY lost, can someone please help me understand what to do and where to even start?

Recommended Answers

All 2 Replies

You need to explain your problem better. What is a subdomain? Why are "keys"? What about the binary tree lets you search efficiently? If it's just a binary tree, and not the more specific case of a binary search tree, you'll just have to search through the nodes linearly.

Member Avatar for arcticM

the search looks for 2 nodes as I said for example 3,9- then we are looking for the part of the tree between the nodes that hold those keys (3,9)
I meant to say it's a binary search tree and the keys/value (it's a search tree for numbers, so key is a number) 1 to n were inserted randomly, and then I need to do count the number of nodes the algorithm goes through in the search, and show the worst, average and best case performance, as a function of the nodes in the tree, and the number of nodes between the two nodes the algorithm looks for..
I wish I could explain myself better but it's hard to explain something that I don't understand at all!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.