Slashdot Mirror


Researching Searching Algorithms?

NiN3x asks: "I have recently written a sorting algorithm that can be close to four times as fast as quicksort and never much slower. I was wondering if there are lots of sorting algorithms like this out there. I don't think I could be the only one that has thought of something like this. I am only in my second year of computer science, so I don't know a lot about these things. I have tried searching the net and can't find anything. My algorithm is NOT an inplace sorting algorithm. Can anyone point me to some sources for this type of thing?"

6 of 62 comments (clear)

  1. Bible by Anonymous Coward · · Score: 4, Informative

    Knuth, Donald E., The Art of Computer Programming Vol 3.

  2. Funny that this topic came up... by ed1park · · Score: 5, Informative

    As I was just studying algorithms last night. The following is considered one of the most definitive books on algorithms.

    Art of Computer Programming, Volume 3: Sorting and Searching by Donald Knuth

    http://www.amazon.com/exec/obidos/tg/detail/-/02 01 896850/qid=1035291515/sr=8-3/ref=sr_8_3/002-899931 0-6640041?v=glance&n=507846

    And since you are a student, go show it to a CS professor for immediate feedback. My guess will be that you haven't properly analyzed the O(n) performance.

  3. Algorithm resources by Twylite · · Score: 5, Informative

    The definitive online resource for algorithms is NISTS's Dictionary of Algorithms and Data Structures. There is a list of algorithm resources, and you can also find some free e-books using The Assayer.

    In print you should be looking for "Introduction to Algorithms, 2nd edition". It is the bible of the field. Other excellent candidates are "Data Structures and Algorithms" ( / in Java / in C).

    Google will also tell you to look here, here and here.

    --
    i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
  4. Apples and Oranges? by Bazzargh · · Score: 5, Informative

    Quicksort is an in-place sorting algorithm. If you're not sorting in place it's well known that you can do better. Telling us the sort isn't in-place means your either doing an external sort (which isnt where you'd use quicksort) or you're breaking the other condition - the constant memory limit. I'm guessing you're doing the latter - trading time for space - and its /well known/ that better sorts exist in this case.

    The easy way to show that faster sorts exist is to demonstrate absurd limit case of a tradeoff of space for speed. Consider you have an unlimited amount of memory available for your sort results, and that you are sorting a finite number of keys N for which a mapping M(n) exists to the positive integers. Then, since there can be at most N duplicates of any given key, scanning the data once and placing each key n(i) in memory address N*M(n(i))+i sorts all the data. This is O(N), and pretty much optimal.

    If you know there are no duplicates and the keys fill a known range this can be practical.

    A good place to start reading about other sorting algorithms is here: http://www.nist.gov/dads/HTML/sort.html

  5. Google? by mnordstr · · Score: 4, Informative
  6. *sigh* by SomeGuyFromCA · · Score: 3, Informative

    #1, Google and see if someone else has already worked on the algorithm. "Nothing new under the sun".

    #2, if that gives you no results, post the code or at least pseudo-code so we can comment. Not "I have a new miracle development that could be revolutionary; please comment on it with no clue as to exactly what it is or how it works."

    #3, talk to a CS professor. You should know plenty of them.

    And the obligatory link - http://www.cs.ubc.ca/spider/harrison/Java/sorting- demo.html.

    --
    if the answer isn't violence, neither is your silence / freedom of expression doesn't make it alright