Click here to Skip to main content
15,886,518 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralA la recherche des nombres premiers Pin
Luc Pattyn3-Dec-08 16:37
sitebuilderLuc Pattyn3-Dec-08 16:37 
GeneralRe: Wheel Factorization to simplify a Sieve of Eratosthenes Pin
PIEBALDconsult3-Dec-08 5:06
mvePIEBALDconsult3-Dec-08 5:06 
GeneralRe: Wheel Factorization to simplify a Sieve of Eratosthenes Pin
Luc Pattyn3-Dec-08 5:53
sitebuilderLuc Pattyn3-Dec-08 5:53 
AnswerRe: Wheel Factorization to simplify a Sieve of Eratosthenes [modified] Pin
PIEBALDconsult9-Jan-09 11:53
mvePIEBALDconsult9-Jan-09 11:53 
QuestionEfficient Search/Comparison Algorithm Pin
SanchitK20-Nov-08 3:29
SanchitK20-Nov-08 3:29 
AnswerRe: Efficient Search/Comparison Algorithm Pin
Member 419459320-Nov-08 6:17
Member 419459320-Nov-08 6:17 
AnswerRe: Efficient Search/Comparison Algorithm Pin
Alan Balkany20-Nov-08 10:20
Alan Balkany20-Nov-08 10:20 
AnswerRe: Efficient Search/Comparison Algorithm Pin
cmk20-Nov-08 12:59
cmk20-Nov-08 12:59 
You may also want to look at a radix tree:
http://en.wikipedia.org/wiki/Radix_tree[^]

It will save the time required to calculate a hash for each of the billions of records at the cost of a longer search per record.

Hash table:
- calc hash of record (slow)
- check table for hash value (quick)
- handle searching collisions (quick)
- if found matching hash in table do a full string compare on string record and hash table record as hash algo can produce same hash for different strings. (slow)

Radix tree:
- search tree for record string (slow)

The radix should be faster. The hash function will likely have a similar cost to the radix tree search. It may even be worse as the hash looks at each character in the string whereas the radix search can fail out early.

...cmk

The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack

GeneralRe: Efficient Search/Comparison Algorithm Pin
Member 419459320-Nov-08 14:18
Member 419459320-Nov-08 14:18 
GeneralRe: Efficient Search/Comparison Algorithm Pin
cmk20-Nov-08 16:21
cmk20-Nov-08 16:21 
GeneralRe: Efficient Search/Comparison Algorithm Pin
Alan Balkany21-Nov-08 3:35
Alan Balkany21-Nov-08 3:35 
GeneralRe: Efficient Search/Comparison Algorithm Pin
supercat921-Nov-08 9:44
supercat921-Nov-08 9:44 
GeneralRe: Efficient Search/Comparison Algorithm Pin
Alan Balkany21-Nov-08 11:35
Alan Balkany21-Nov-08 11:35 
Question[Message Deleted] Pin
De@r17-Nov-08 3:45
De@r17-Nov-08 3:45 
AnswerRe: convert bubble sort to quick sort Pin
73Zeppelin17-Nov-08 5:48
73Zeppelin17-Nov-08 5:48 
QuestionWumpus problem Pin
hockymot2008_200915-Nov-08 3:32
hockymot2008_200915-Nov-08 3:32 
AnswerRe: Wumpus problem Pin
Reynolds Glisner15-Nov-08 13:23
Reynolds Glisner15-Nov-08 13:23 
GeneralRe: Wumpus problem Pin
hockymot2008_200916-Nov-08 4:25
hockymot2008_200916-Nov-08 4:25 
GeneralRe: Wumpus problem Pin
Member 419459316-Nov-08 4:59
Member 419459316-Nov-08 4:59 
GeneralRe: Wumpus problem Pin
Mark Churchill16-Nov-08 13:07
Mark Churchill16-Nov-08 13:07 
AnswerRe: Wumpus problem Pin
73Zeppelin16-Nov-08 6:04
73Zeppelin16-Nov-08 6:04 
Questionhow to convert plural word to singular? Pin
hawkgao012913-Nov-08 23:49
hawkgao012913-Nov-08 23:49 
AnswerRe: how to convert plural word to singular? Pin
73Zeppelin14-Nov-08 0:39
73Zeppelin14-Nov-08 0:39 
GeneralRe: how to convert plural word to singular? Pin
User 171649214-Nov-08 1:13
professionalUser 171649214-Nov-08 1:13 
GeneralRe: how to convert plural word to singular? Pin
73Zeppelin14-Nov-08 2:18
73Zeppelin14-Nov-08 2:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.