- AuthorPosts
- August 23, 2013 at 7:21 pm #11287LTTParticipant
I think the [Stable Sort] Option is not working correctly.
For example, the original text (Tab-separated):
z z
z y
a b
a aIn TSV mode:
No matter if the [Stable Sort] option is on or off, [Sort A to Z] (by the 1st column) always gives the Stable sort:
a b
a a
z z
z yIn normal mode:
No matter if the [Stable Sort] option is on or off, [Sort A to Z] always gives the Non-Stable sort:
a a
a b
z y
z zAugust 23, 2013 at 10:12 pm #11288Yutaka EmuraKeymasterHello LTT,
This is a correct behavior.
In normal mode, “a a” should come earlier than “a b”, so
a a
a b
z y
z zis correct.
August 24, 2013 at 10:50 am #11290LTTParticipantBut how to do Non-Stable sort in TSV mode?
Or, How to use the [Stable Sort] option?August 24, 2013 at 4:11 pm #11291Yutaka EmuraKeymasterHi LTT,
You will have to change to Normal mode before you sort, and then change back to TSV mode. Does this answer your question?
August 24, 2013 at 10:39 pm #11292LTTParticipantSorry but I still don’t know when to use the [Stable Sort] option in [Tools >> Customize >> Sort]. :-(
August 25, 2013 at 1:49 am #11294Yutaka EmuraKeymasterHi LTT,
If the Stable Sort is on, in TSV mode, and if the cursor is at the first column,
a b
a a
z z
z yis correct. Only the first column is used to sort, and the second column order is unchanged. If the Stable Sort is off, the second column order can be changed (the behavior is undefined).
Stable Sort is useful if you want to maintain the order of more than one column where there are multiple columns.
August 25, 2013 at 10:52 pm #11302LTTParticipantIf the Stable Sort is off, the second column order can be changed (the behavior is undefined).
Could you give an example that in TSV mode the Non-Stable sort result differs from the Stable one?
August 26, 2013 at 12:22 am #11303Yutaka EmuraKeymasterYou will need to use a large file to test this.
Please try this:
file deletedand then you can sort with stable sort, without stable sort, and compare two. I found these differences:
stable sort:
10012 10012
10012 20012
10013 10013
10013 20013
10014 10014
10014 20014
10015 10015
10015 20015non-stable sort:
10012 20012
10012 10012
10013 20013
10013 10013
10014 20014
10014 10014
10015 20015
10015 10015The non-stable sort result may be different from yours since the behavior is undefined.
Thanks!
August 26, 2013 at 8:20 pm #11305LTTParticipantThank you very much for the explanation and the example.
- AuthorPosts
- You must be logged in to reply to this topic.