[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Search Algorithm



--- Ron Johnson <ron.l.johnson@cox.net> wrote:

> On Mon, 2004-11-15 at 10:25 -0800, Sergio Basurto
> Juarez wrote:
> > First of all, I want to leave clear that I know
> that
> > the question that I am asking for, does not have
> to do
> > with this list, but I dare to ask this question
> here
> > because I am sure that here are a lot of good
> > programming and scientisitics guys and may be one
> of
> > you can help me.
> > 
> > I am programming a function to search in an array,
> I
> > know there is the binarysearch algorithm, an other
> > good methods to search, but I want something that
> does
> > not take to long.
> 
> If the data points are ordered, a binary search is
> pretty darned
> fast.  And a simple algorithm, too.  Unless you need
> to wring the
> last nanosecond of speed from your app, a good,
> simple algorithm
> is better than a slightly better complicated
> algorithm.
> 
> For an array of 8240 elements, you'd need a max of
> (dredging up 
> college class...) log2(16384) ( = 14) memory
> accesses.
> 
First of all thanks for the note, I think I will use a
Hashing Table as some one suggest here, becuase in
this case seems to be more suitable for the problem,
why am so worry about speed, is becuase is a web
application in php, and it takes to long with the
binarysearch algorithm, nevertheless I am testing the
same with Hashing Tables and it suits to what I am
looking in time consuming.

Also I was wondering if there were some magic equation
that do the trick without hashing tables, but I think
the time that will take me to find some one is too
much so I will use hashing tables meanwhile.

Thanks again.



=====
--
Sergio Basurto J.

If I have seen further it is by standing on the 
shoulders of giants. (Isaac Newton)
--


		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 



Reply to: