Re: Search Algorithm

From: Paul Tsai (paul_at_thirdaspect.net)
Date: 11/16/04

  • Next message: Christian Christmann: "SCP GUI"
    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
    

  • Next message: Christian Christmann: "SCP GUI"

    Relevant Pages

    • Re: editor, is C obsolete?, and thank you
      ... With other languages you fiddle to get the algorithm to work with the rest of the system. ... So now we've got a horrible job documenting not only our parser, but also the exception object it throws. ... You need some sort of tokenizer function. ... However you need a certain amount of experience - it's not the language of choice for developing parser technology in, or for learning how to implement a parser. ...
      (comp.lang.c)
    • Re: Sorting algorithm
      ... language and algorithm implementation. ... Which sorting algorithm is the fastest to sort the numbers, quick sort, ...
      (comp.programming)
    • P Versus NP
      ... determine whether every language accepted by some nondeterministic ... algorithm in polynomial time is also accepted by some ... L = Lfor some Turing machine M which runs in polynomial time} The ... We say that R is polynomial-time iff L R ...
      (sci.math)
    • Re: Mr. P and Ms. S
      ... determine whether every language accepted by some nondeterministic ... algorithm in polynomial time is also accepted by some ... L = Lfor some Turing machine M which runs in polynomial time} The ... We say that R is polynomial-time iff L R ...
      (sci.math)
    • Re: pseudo code v/s algorithm
      ... insert your language here) than code. ... There is absolutely no difference between algorithm and code, ... If I have an implementation or pseudo-code it cannot be ... Turing Machine or lambda-calculus in it, modulo the infinite memory ...
      (comp.programming)