[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stable sorts
From: |
Ben Abbott |
Subject: |
Re: stable sorts |
Date: |
Sat, 25 Aug 2012 18:44:53 -0400 |
On Aug 25, 2012, at 6:18 PM, Michael D Godfrey wrote:
> On 08/25/2012 05:55 PM, Ben Abbott wrote:
>
>> ok. Thanks. The sort() in Matlab 2011b is stable.
>> i =
>>
>> 4
>> 1
>> 2
>> 3
>> 5
>
> Ben,
> I read this as NOT stable, just like Octave.
> Stable would give: 4 1 3 2 5
>
> Something wrong?
> Michael
I assume wiki has the correct definition?
"Stable sorting algorithms maintain the relative order of records with equal
keys."
http://en.wikipedia.org/wiki/Sorting_algorithm#Stability
Since since x(2) and x(3) == 2, it looks to me as if Matlab's result is stable
(relative order is maintained).
Ben
- stable sorts, Michael D Godfrey, 2012/08/25
- Re: stable sorts, Ben Abbott, 2012/08/25
- Message not available
- Message not available
- Re: stable sorts, Ben Abbott, 2012/08/25
- Re: stable sorts, Michael D Godfrey, 2012/08/25
- Re: stable sorts,
Ben Abbott <=
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Re: stable sorts, Michael D Godfrey, 2012/08/25
- Re: stable sorts, Ben Abbott, 2012/08/25
- Re: stable sorts, Michael D Godfrey, 2012/08/25
- Re: stable sorts, Ed Meyer, 2012/08/25
- Re: stable sorts, Michael D Godfrey, 2012/08/25
- Re: stable sorts, Ed Meyer, 2012/08/26
- Re: stable sorts, Daniel J Sebald, 2012/08/26