Hello :)

Umm I have a small question :)

Which do you recommend for fast searching BST or AVL tree?

My answer: It might be the BST because it'll be noticed that in the right subtree all the numbers greater than the root will be there

also for the smaller numbers will be left

so we can search it easily by just knowing the number that we want to search for if it is greater than the root or smaller!


WHAT do you think? Is my answer right?


thanks in advance :)

http://www.nist.gov/dads/HTML/avltree.html

If you pick your root unwisely, your BST may resemble a linked list.

Also consider
- the cost of constructing the tree in the first place
- the cost of keeping it balanced
- the number of searches performed
- the distribution of search results.

You need the whole program scenario to make an accurate judgement.

Well, I guess I found that the AVL is much more faster than BST because if we use AVL we'll get the smallest tree by obtaining it balanced all the way

so the answer would be AVL tree is more faster in search from BST

thanks my friend :)

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.