|
-
September 21st, 2003, 02:30 PM
#1
sorting algorythm that keeps the order of equal elements
hello !
i need to find an algorythm for sorting that keeps the order of equal elements...
all that i've tried are messing up my data...
also, maybe that algorythm has a form in witch i can implement a time routine to see how much time remains until full sorting...
maybe someone known such as algorythm...
thanks !
PS : excuse my english...
-
September 21st, 2003, 02:48 PM
#2
I'm not fully sure I understand you... but maybe you want a so called stable sorting algorithm, such as radix sort.
Search on www.google.com for more info about it.
-
September 21st, 2003, 05:00 PM
#3
In C++, use std::stable_sort()
Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
-- Sutter and Alexandrescu, C++ Coding Standards
Programs must be written for people to read, and only incidentally for machines to execute.
-- Harold Abelson and Gerald Jay Sussman
The cheapest, fastest and most reliable components of a computer system are those that aren't there.
-- Gordon Bell
-
September 22nd, 2003, 08:13 AM
#4
The STL comes indeed with stable_sort, which is most probably implemented in terms of a merge sort. The run-time characteristics of this sorting method are pretty predictable, so you should be able to modify it so that it gives a sort of progress-report. Other sorting algorithms, like quicksort or introsort (the std::sort algorithm) are not that predictable.
Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
Supports C++ and VB out of the box, but can be configured for other languages.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|