newbie question.. searching algorithm

N

neonski

hello! i just wanna know what do you think the best searching
algorithm? im kinda new in C.. thanks in advance!
 
W

Walter Roberson

:hello! i just wanna know what do you think the best searching
:algorithm? im kinda new in C.. thanks in advance!

I don't mean this to sound abrupt, but there is no -one- best searching
algorithm. The search algorithm that one should use depends upon what
one needs to search for, how the key being searched for is structured,
how the data being searched in is structured, and upon factors such as
how often the data will being searched will have to be updated.

If one knows all the search keys ahead of time, and there is only one
occurance of the target (e.g., entries in a symbol table), then there
is an algorithm called "perfect hashing" which can find exactly the
right position in one step. But if, for example, one were trying to
write a new version of Google and the data had to be updated hundreds
of times a second, and people might search for wacky combinations, then
one needs a very different algorithm.

One also needs different algorithms if one needs to do "fuzzy matching"
(e.g., automatically correct for common spelling mistakes, or
automatically convert between British English and American English, or
automatically adjust American slang such as "truck" to the more proper
British "lorry". And if one should automatically recognize singular/
plural distinctions and either adjust the key or the target text
so as to be able to automatically find both forms, then one has to
know a lot more than how do to a simple binary search.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,161
Messages
2,570,892
Members
47,427
Latest member
HildredDic

Latest Threads

Top