Re: Search Algorithm
From: Paul Tsai (paul_at_thirdaspect.net)
Date: 11/16/04
- Previous message: Paul Johnson: "Re: Antivirus/Antispyware/Antiadware for linux?"
- In reply to: Sergio Basurto Juarez: "Re: Search Algorithm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 16 Nov 2004 12:25:35 -0500 To: Sergio Basurto Juarez <sbasurtoj@yahoo.com>
Sergio Basurto Juarez wrote:
>--- Eric Gaumer <gaumerel@ecs.fullerton.edu> wrote:
>
>
>
>>On Mon, 2004-11-15 at 12:09 -0800, Sergio Basurto
>>Juarez wrote:
>>
>>
>>>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.
>>>
>>>
>>The binary search is O(logn) which is quite fast. It
>>reduces your
>>problem by half on each iteration (divide and
>>conquer). The problem is
>>the sort. You haven't really specified enough about
>>the problem to
>>helpful. If you need fast search times then why use
>>an array? You should
>>be using some tree structure if you really want
>>efficient search times.
>>Obviously a good hash is going to be O(1) depending
>>on your collision
>>handling.
>>
>>In this case I would suggest a different language.
>>It's not the
>>algorithm itself but rather the language. Try coding
>>this part in a
>>different language. Even Perl will me much faster.
>>The STL is the way to
>>go these days. Try using a vector with the STL sort
>>and find algorithms
>>and you'll see it's very fast and probably meets the
>>speeds of a hash in
>>PHP.
>>
>>Don't get me wrong, I'm not bashing PHP. It's just
>>that it wasn't
>>designed for intense algorithmic purposes. The web
>>is very flexible and
>>mixing languages shouldn't be too difficult to do. I
>>know Python does
>>extending and embedding.
>>
>>Don't just look at the algorithm, look at the whole
>>picture.
>>
>>
>>
>Ok good advice, I think you are quite right, maybe I
>am trying to do something with a language that is not
>designed to do what I want.
>
>Even I am thinking in C as a cgi.
>
>Than you.
>
>=====
>--
>Sergio Basurto J.
>
>If I have seen further it is by standing on the
>shoulders of giants. (Isaac Newton)
>--
>
>
>
>__________________________________
>Do you Yahoo!?
>Meet the all-new My Yahoo! - Try it today!
>http://my.yahoo.com
>
>
>
>
>
This could be a moot point, but it seems you are trying to access data,
perhaps you can use a database of some sort.
Paul
-- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
- Previous message: Paul Johnson: "Re: Antivirus/Antispyware/Antiadware for linux?"
- In reply to: Sergio Basurto Juarez: "Re: Search Algorithm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|