Any interest in a sorting library with a multitude of sorts?

This sorting library would have quicksorts, radix quicksorts, radixsorts, mergsorts, a sorted-array class, and an interface class to be inherited from to allow sorting. _________________________________________________________________ Find a local pizza place, movie theater, and more .then map the best route! http://maps.live.com/?icid=hmtag1&FORM=MGAC01

Do you have some example code that people can look at? You might want to post it to the vault. <http://www.boost-consulting.com/vault/> Chris On 3/13/07, Sam Schetterer <samthecppman@hotmail.com> wrote:
This sorting library would have quicksorts, radix quicksorts, radixsorts, mergsorts, a sorted-array class, and an interface class to be inherited from to allow sorting.
_________________________________________________________________ Find a local pizza place, movie theater, and more….then map the best route! http://maps.live.com/?icid=hmtag1&FORM=MGAC01
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Sam Schetterer wrote:
This sorting library would have quicksorts, radix quicksorts, radixsorts, mergsorts, a sorted-array class, and an interface class to be inherited from to allow sorting.
Most users, on finding they need to sort data, use something someone else has already written, such as the sort functions available in the STL. What could your library offer that this does not? A couple of suggestions to answer my own question: * Most programmers use quicksort without giving consideration to any other algorithms, because quicksort is often the best solution. It is not always best, of course: heap sort and merge sort are sometimes better (for example, if the data are already nearly sorted, merge sort might be better). An interesting feature that your library could provide would be a recommendation of which sort to use. I don't know if there is a criterion (short of actually doing the sort by various methods) that can be tested quickly to see which sort is likely to be fastest. You could see if the data is nearly in order (perhaps using a rank correlation) but this would not necessarily mean that a merge sort would be fastest. A wish-list of ideas: * Sorting into reverse order or forwards order * Allowing the user to choose the "less-than" operator (as the STL sorts already do) * A "sort by" function: class X { std::string name; int age; float height; } X array[10]; //set members of elements of arrays here... sort_by(array, age); //sorts the array by age //then, later on sort_by(array, height); * A "sort within sort" function: sort_by(array, name, age); //sort array by name, and then sort within name by age giving: Fred, 23 Fred, 31 Jane, 34 Joe, 18 Julie, 29 Julie, 43 Kate, 51 (etc) so the names are in alphabetical order, and any duplicate entries with the same name are sorted within themselves by age. This would be nestable to any depth, up to the number of members of the class that can be ordered, so you could also have: sort_by(array, name, height, age); Just a few ideas.

On 3/13/07, Paul Giaccone <paulg@cinesite.co.uk> wrote:
A wish-list of ideas:
* Sorting into reverse order or forwards order * Allowing the user to choose the "less-than" operator (as the STL sorts already do) * A "sort by" function:
Aren't the first and third a sub-case of the second one?

Olaf van der Spek wrote:
On 3/13/07, Paul Giaccone <paulg@cinesite.co.uk> wrote:
A wish-list of ideas:
* Sorting into reverse order or forwards order * Allowing the user to choose the "less-than" operator (as the STL sorts already do) * A "sort by" function:
Aren't the first and third a sub-case of the second one?
Yes, it looks they are. Well, that makes less work for Sam to do :-)

On 3/13/07, Paul Giaccone <paulg@cinesite.co.uk> wrote:
Sam Schetterer wrote:
This sorting library would have quicksorts, radix quicksorts, radixsorts, mergsorts, a sorted-array class, and an interface class to be inherited from to allow sorting.
Most users, on finding they need to sort data, use something someone else has already written, such as the sort functions available in the STL. What could your library offer that this does not? [...] A wish-list of ideas:
* Sorting into reverse order or forwards order * Allowing the user to choose the "less-than" operator (as the STL sorts already do) * A "sort by" function:
class X { std::string name; int age; float height; }
X array[10];
//set members of elements of arrays here...
sort_by(array, age); //sorts the array by age
//then, later on sort_by(array, height);
Aren't all of these trivial applications of bind?
* A "sort within sort" function:
sort_by(array, name, age); //sort array by name, and then sort within name by age
Isn't sort + stable sort enough? Do we really need specialized interfaces for these? gpd

Giovanni Piero Deretta wrote:
Isn't sort + stable sort enough?
Do we really need specialized interfaces for these?
I for one would like a generic radix sort where I could specify the number of bits to grab and where in a UDT to grab each bit or a range of bits from. Do you really see no use for a O(n) sorting algorithm?

On 3/14/07, Michael Marcin <mmarcin@method-solutions.com> wrote:
Giovanni Piero Deretta wrote:
Isn't sort + stable sort enough?
Do we really need specialized interfaces for these?
I for one would like a generic radix sort where I could specify the number of bits to grab and where in a UDT to grab each bit or a range of bits from.
Do you really see no use for a O(n) sorting algorithm?
I was speaking about the various "reverse sort", "sort by field", "sort by two fields" etc. I definitely think that a radix sort would be useful. gpd

I'm care for how many times of collecting the radix sort needed while sort some very long string, such as "012..9abc..zABC..Z". 2007/3/14, Giovanni Piero Deretta <gpderetta@gmail.com>:
On 3/14/07, Michael Marcin <mmarcin@method-solutions.com> wrote:
Giovanni Piero Deretta wrote:
Isn't sort + stable sort enough?
Do we really need specialized interfaces for these?
I for one would like a generic radix sort where I could specify the number of bits to grab and where in a UDT to grab each bit or a range of bits from.
Do you really see no use for a O(n) sorting algorithm?
I was speaking about the various "reverse sort", "sort by field", "sort by two fields" etc. I definitely think that a radix sort would be useful.
gpd _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (7)
-
Ben Bear
-
Chris Weed
-
Giovanni Piero Deretta
-
Michael Marcin
-
Olaf van der Spek
-
Paul Giaccone
-
Sam Schetterer