Re: Searching in a random list



adintimes@xxxxxxxxx said:

Hi all,

Give that I have a list of numbers say from 1 to a million. They are
not stored in any
order. Now if I want to search for a specific number. What is the best
search
methodology to use. What is the best timing that I can achieve. Any
feedback on this will be highly
appreciated.

If they're not in any order, you have to look at every one. There Is No
Free Lunch. If you have to do this more than log n times, consider sorting
them at the outset.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages

  • Re: next term
    ... Richard Heathfield ... Google users: ... me@here> cat mapping.dot | dot -Tpng -o mapping.png ...
    (rec.puzzles)
  • Re: Whats the position of pointers
    ... will pop into your head, ... Richard Heathfield ... Google users: ...
    (comp.lang.c)
  • Re: new random numbers function
    ... So as long as you don't mind getting a two or a three 90% of the ... Richard Heathfield ... Google users: ...
    (rec.puzzles)
  • Re: An age-old riddle
    ... inscription into its right proportions. ... Richard Heathfield ... Google users: ...
    (rec.puzzles)
  • Re: sizeof dataTypes at run time
    ... "sizeof dataTypes at run time". ... Sorry for my misunderstanding. ... Richard Heathfield ... rjh at the above domain, ...
    (comp.lang.c)