The Grey Labyrinth is a collection of puzzles, riddles, mind games, paradoxes and other intellectually challenging diversions. Related topics: puzzle games, logic puzzles, lateral thinking puzzles, philosophy, mind benders, brain teasers, word problems, conundrums, 3d puzzles, spatial reasoning, intelligence tests, mathematical diversions, paradoxes, physics problems, reasoning, math, science.
| |
|
|
|
|
|
|
|
|
|
| View previous topic :: View next topic |
| Author |
Message |
MTGAP
Daedalian Member
|
Posted: Sun Apr 12, 2009 11:12 pm Post subject: 1 |
|
|
I am trying to write a program that requires the sorting of a list that contains about 50,000 elements, and I need an efficient sorting algorithm. I was going to use the Quicksort http://linux.wku.edu/~lamonml/algor/sort/quick.html algorithm, but I think it only works if the array of elements contains only numbers from 1 to <number of elements>, which is not the case for my program. I need an efficient algorithm that sorts an array containing any numbers, and it needs to be efficient for sorting 50,000 elements and at the same time not use up all my computer's memory. I am currently using the Shell http://linux.wku.edu/~lamonml/algor/sort/shell.html algorithm, but it seems awfully slow.[/url] _________________ This statement is false. |
|
| Back to top |
|
 |
wordcross

|
Posted: Sun Apr 12, 2009 11:45 pm Post subject: 2 |
|
|
quicksort shouldn't be limited to arrays of a set size. If done correctly it should use recursion to repeatedly halve whatever array you throw at it. _________________ Has anyone really been far even as decided to use even go want to do look more like? |
|
| Back to top |
|
 |
MTGAP
Daedalian Member
|
Posted: Mon Apr 13, 2009 12:57 am Post subject: 3 |
|
|
| wordcross wrote: |
| quicksort shouldn't be limited to arrays of a set size. If done correctly it should use recursion to repeatedly halve whatever array you throw at it. |
Ah... I was under the impression that quicksort wasn't working because I was inputting the array as being one longer than it actually was, so it was trying to access a nonexistent memory address. Great.
It works now. Thanks for the help. _________________ This statement is false. |
|
| Back to top |
|
 |
wordcross

|
Posted: Mon Apr 13, 2009 2:45 am Post subject: 4 |
|
|
no problem  _________________ Has anyone really been far even as decided to use even go want to do look more like? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|
|
Site Design by Wx3
|
|
|
|