Hi,
Does anyone know which search is more efficient, the hash table search or the Binary Search Tree search..Respond only if you're confident of your answer. If possible, please also explain. Thanks.
A
Hi,
Does anyone know which search is more efficient, the hash table search or the Binary Search Tree search..Respond only if you're confident of your answer. If possible, please also explain. Thanks.
A
For a properly designed hash table access is O(1).
If not designed right worse case is O(n). binary search trees
average case is O(lg n) and worse case is O(n).
You will have to get a book to see a fuller explanation.
>Does anyone know which search is more efficient, the hash table search or the Binary Search Tree search..
It depends on the tree structure you're using and the quality of your hash table implementation. A balanced binary tree has an O(log n) search complexity while a well made hash table has O(1) complexity. So if both are made well then the hash table will be more efficient for searching.
>Respond only if you're confident of your answer.
Of course, I could be wrong.
-Prelude
My best code is written with the delete key.
Thanks guys..any more responses anyone?
A
Sure!
Do your own homework. Learn to use a search engine. If this is not homework and you want to know what to use for your code then go with the hashed structure.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi