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?"
Knuth, Donald E., The Art of Computer Programming Vol 3.
Is there some reason why you cannot publish it here for a review? A basic C reference cannot be very many lines? This way people could give real input for you. I don't believe you have much to lose. If you do, attach your favorite license to it :)
Or provide a link to a file so we can properly answer your question. How can we know that your algorithm works or that haven't been implemented before with such a vague description?
Buy a Nintendo DS Lite
They've used modern algorithms extensively throughout, since Perl is geared mostly to string (scalar) processing.
If your algorithm is general-purpose and happens to be faster, why not GPL/LGPL/BSD it and contribute to Perl's, Python's, and PHP's sorting and searching code?
CmdrTaco has recently lost his personal butt boy due to a contract dispute. Maybe NiN3x would like to service CmdrTaco and CowboyNeal for minumum wage so that he can pay for his tuition
As I was just studying algorithms last night. The following is considered one of the most definitive books on algorithms.
2 01 896850/qid=1035291515/sr=8-3/ref=sr_8_3/002-899931 0-6640041?v=glance&n=507846
Art of Computer Programming, Volume 3: Sorting and Searching by Donald Knuth
http://www.amazon.com/exec/obidos/tg/detail/-/0
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.
Shouldn't be: Researching Sorting Algorithms?
I take it your algorithm is redundant?
_sig_ is away
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
Have you communicated it to him yet? "G. A new, super sorting technique that is a definite improvementover known methods. (Please communicate this to the author at once.)" From TAOCP chapter 5.2 introduction.
I found my inner child, then I got caught abusing it...
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
There are lots of algorithms out there that seem to be multiples faster than quicksort in daily use. The problem is when you formally analyze them, you find out their not gauranteed to be faster, and could in fact be horribly slower. If you run it enough times against various wierd data, you'll probably hit one of these slow runs yourself. I can only guess because you haven't mentioned anything about the algorithm or shown any sample code. Read up on how to analyze your code for O() notation and figure out what the real worst case is mathematically.
11*43+456^2
I call bullshit on this one.
If the sorting algorithm is so superior, why not post it, so everyone can give critique?
If it's not broken in some manner, i bet Knuth already covered it in his bible on the topic.
Even if it is broken, Knuth probably already covered why.
---
On another note,
if you like "articles" like this one, here's more by Cliff.
Seems Cliff has stood for at least 90% of the "Ask slashdot"s lately, and 100% of the dumb ones. I wonder how many he made up himself.
Still, this is not one of the worst ones.
If you want to block "articles" by Cliff, go here.
I assume you have checked these out:h ms/Sorting_and_Searching/
http://directory.google.com/Top/Computers/Algorit
Why don't you go and talk to your professor, then? At least someone from the CompSci faculty should be able to help you. If not, then you're probably studying at the wrong university
Post your algorithm, then!
There are many implementations of quicksort-like sorts, but when done well, quicksort is pretty damn fast. For instance, if you're measuring against a version that doesn't special case arrays of size 3, 4, and maybe even bigger, then it will run many times slower than a tuned version. You won't be able to beat quicksort (with proper pivot-picking) asymptotically, so there won't be any ground-breaking result here, but it's probably possible to beat its constant factors (which may be practically useful)... and there are probably many people here who'd be willing to look at the algorithm if you posted it.
Once this is done, how do you find the lowest element on the list, second lowest, and so on? ...
And, random access to memory should be considered O(log(N)) for a given memory size
#1, Google and see if someone else has already worked on the algorithm. "Nothing new under the sun".
- demo.html.
#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
if the answer isn't violence, neither is your silence / freedom of expression doesn't make it alright
What's the deal with Ask Slashdot lately?
"I'm a 2nd year cs student, and I discovered an unknown searching algorithm. I won't provide any details, though"
"I'm not that good at math, but I just invented a new unbreakable multipad encryption. I won't provide any details, though"
"During my lunch break, I used a couple coat hangers, some aluminum foil, a 3 hole punch, a spare xeon-argon laser, and 32oz of diet pepsi to create my own home-brewed cold fusion reactor."
Can you identify the PhysicsGenius troll from the Ask Slashdot question?
And people complain about what gets through the US Patent Office!
Do you even lift?
These aren't the 'roids you're looking for.
Piss Frost
Yeah, I have to agree that these Ask Slashdot questions are getting worse and worse. In a comment I made to a previous Ask Slashdot, I suggested that the forum should be reserved for questions that stimulate a large amount of discussion on issues that do not have any obvious answers. I really don't understand what criteria the slashdot editors use to determine whether to post an Ask Slashdot submission or not. Every so often there is a really good Ask Slashdot question so I don't want to filter this out from my preferences. But part of me gets annoyed with people posting crap Ask Slashdot questions even if I have the sense not to read them.
I've seen journalists and students asking questions here along the lines of "please do my investigation for me" and this gets accepted. Then we have these people who think they've developed some new ingenious algorithm but haven't bothered to have ANYONE look at their work. I realize my post is starting to ramble at this point so I think I'll end with one request that I pray the slashdot editors will read and consider: please tighten up the criteria for what gets accepted as an Ask Slashdot question. So many of these questions are simply the result of laziness on the part of the submitter. My earlier post (that I linked to above) is one suggestion for what Ask Slashdot questions should be like. I welcome other people's ideas as well.
GMD
watch this
So *that's* what I've been doing wrong all these years!
Moderate drunk! It's more fun that way!
I have tried searching the net and can't find anything. It appears the new algoritm has been sufficiently tested.
If you want to prove that you've had the algorithm longer, discovered it, etc.. print it out and have it notorized. You can go to a notary for $5-10 (US).
;)
First, as others said.. profile it. What is the asymptotic upper bound (O-notation)? Read "Introduction to Algorithms",written by Cormen, Leiserson, and Rivest. Dispite the name, reading that book is not a simple task
Oh, and go to one of your professors for verification.
That's a poorly designed animation page.
I used to have a set of pages up (currently dead) that launched 6 different implementations with a single click... and the animations had 50, 100, and 250 lines. Not isolated sorts
With 50 points, you think quick sort is faster, but think the simplicity of some of the other sorts may make them preferable.
But with just 250 points, you have no doubts about the relative performance of the various algorithms.
For every complex problem there is an answer that is clear, simple, and wrong. -- H L Mencken
I usually use ORDER BY like in this example:
SELECT * FROM Articles ORDER BY ArticleId
It works every time. Don't need any log() or sin() or any of that fancy stuff.
http://www.millnet.se/ GO/U d- s+:+ a C++ UL++++ P- L+++ E W+++ N+ w++ M-- PE+ t+ X++
another catagory I know is:
Is it stable or un-stable?
If you've come up with a truly asymptotically better algorithm, then why don't you talk with someone at you CS department? I'm sure someone would like to take a quick look, at least it shows that their students actually want to learn and do study/think/research on their own.
Have you analyzed your algorithm yourself? Is it asymptotically equivalent to something like quicksort, but it just has a tighter inner-loop? Does it have a better average running time on random input? Does it work always (or is it flawed/probabilistic)? I think those are the questions you need to have answered.
Where the art and the science of algorithms diverge is in their implementation. Does a bubble sort in hand optimized assembly language on 3GHz machine beat a quicksort written in GW Basic running on an antique 386? What differences are there between data already stored in memory vs. sorting data that is on a remote server? What if two algorithms are both O(n), but one's "operations" involves multiple calls to slow libraries, the other one involves just two integer compares.
I know the question raised was on the correct analysis of the algorithm in question, but several of these postings have diverged into languages and types of data. This is good and it is the whole point of a well grounded CS education -- knowing all of the strengths and weaknesses of available algorithms so you can make the correct choices based on the size and type of the data and the language (and libraries of choice).
-- stream of did I lock the front door consciousness
I just finished Kindergarten, where we learned our ABC's, and I've invented an alphabet that can be read 7 times as fast, with only one third the effort. Why didn't some PhD come up with this before?
There are alphabets that are better than Latin in some respect. Take Tengwar for instance. The script is designed along sound phonological principles (no pun intended): voiced consonants, fricatives, and nasals have a predictable change in shape from the basic voiceless stops (p, t, c, q). It's been adapted to at least English, Sindarin, Quenya, Polish, Lojban, Esperanto, and Toki Pona. On the other hand, some people have expressed increased dyslexia due to use of Tengwar.
Will I retire or break 10K?