home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Products
MPTagThat
BugReport: not using a stable column sort algorithm
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Ger Hobbelt" data-source="post: 703074" data-attributes="member: 110133"><p>A context-independent solution to stabilize quicksort (and other unstable sort algo's) is, before performing the sort operation, adding an extra column and fill it with a sequential number sequence (which would represent the current order of appearance of all rows), then do the qsort/whatever, where the sort criterium now includes that extra sequence column as the least significant key part.</p><p></p><p>In short: do not sort on (column) but on (column, seqid).</p><p></p><p>That way you don't have to 'remember' anything <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" /> and it has perceived unlimited recall as any previous operations are all represented together through the temporary sequential number column.</p><p></p><p>This is a generic approach for when you don't know whether the sort code in use (a library call, mostly) is a stable or unstable algorithm.</p></blockquote><p></p>
[QUOTE="Ger Hobbelt, post: 703074, member: 110133"] A context-independent solution to stabilize quicksort (and other unstable sort algo's) is, before performing the sort operation, adding an extra column and fill it with a sequential number sequence (which would represent the current order of appearance of all rows), then do the qsort/whatever, where the sort criterium now includes that extra sequence column as the least significant key part. In short: do not sort on (column) but on (column, seqid). That way you don't have to 'remember' anything :D and it has perceived unlimited recall as any previous operations are all represented together through the temporary sequential number column. This is a generic approach for when you don't know whether the sort code in use (a library call, mostly) is a stable or unstable algorithm. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Products
MPTagThat
BugReport: not using a stable column sort algorithm
Contact us
RSS
Top
Bottom