![]() |
A generic Sorter
|
And what a great tutorial that was :P
|
Quick sort is fun :) Not so easy to work with though if you want a stable sort of course... though it is possible if I recall correctly.... actually now that I think about it, it really is not difficult to implement.
Shell sorts are just... nasty... I hate them, and merge sort, well they are alright, but I do not like the way the recurse ;) |
I'm guessing he's looking for a sort method. Since this is not a tutorial, it has been moved to the Java section from the Java tutorial section.
|
looks to me that he just wants us to do it for him.
|
No idea what this is all about... But gotta love the recursion; hence, the name.
|
Bubble Sort all the way!
Just kidding! But here are two methods for bubble sort with strings...pretty generic... :
static void BubbleSortRecurse(String[] s){ |
haha, bubble sort works... but the convergence on it is NASTY! O(N)^2 is not fun to deal with when working with really large datasets (and yes I have, lol).
Quicksort, that is the way to go :) A little tricky to implement (not as bad a merge sort) but the convergence on it is insane (do not remember it off the top of my head), probably something near O(n). |
Quick sort is probably top notch... but if I am not mistaken there is a faster sorting algorithm available, I do not recall its name. I wouldn't mind trying to make one of my own. :)
|
The only sort I know of that is faster then quick sort is heap Sort. The C++ STL uses a mix of heap sort (non stable) and quick-sort (stable) sorts.
There could be something faster I do not know about though, which is very possible. |
| All times are GMT -5. The time now is 10:05 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC