See https://github.com/zephyrtronium/sort/blob/master/2pqs.go for a dual 
pivot quicksort implementation that just uses Less without duplicate calls 
to Less to simulate Equals!

On Thursday, December 3, 2009 at 8:05:04 PM UTC-5, baldmountain wrote:
>
> I was having a go at porting the dual pivot quicksort to Go and there 
> are a few places where the algorithm tests for equals. You can 
> simulate this with: 
>
> !data.Less(idx1, idx2) && !data.Less(idx2, idx1) 
>
> But this is inefficient. An Equals method would eliminate at least one 
> function call over this method. 
>
> Should we add: 
>
> Equals(i, j int) bool; 
>
> to sorting.Interface? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to