Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-09-08 Thread Xah Lee
i just want to make it known that i think most if not all of the replies in this thread are of not much technical value. They are either wrong and or misleading, and the perl module mentioned about sorting or the Java language aspect on sorting, as they are discussed or represented, are rather

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-30 Thread Tim Peters
[/T] OTOH, current versions of Python (and Perl) [/F] just curious, but all this use of ( Perl) mean that the Perl folks have implemented timsort ? A remarkable case of independent harmonic convergence: http://mail.python.org/pipermail/python-dev/2002-July/026946.html Come to think of

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-30 Thread Joachim Durchholz
Tim Peters schrieb: O() notation isn't being used I was replying to Gabriel's post: In fact it's the other way - losing a factor of 2 is irrelevant, O(2N)=O(N). The logN factor is crucial here. Regards, Jo -- http://mail.python.org/mailman/listinfo/python-list

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-30 Thread Duncan Booth
Tim Peters wrote: [/T] OTOH, current versions of Python (and Perl) [/F] just curious, but all this use of ( Perl) mean that the Perl folks have implemented timsort ? A remarkable case of independent harmonic convergence:

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-30 Thread neoedmund
yeah, java also have 2 interface, Comparator and Comparable, which equal to python's compareTo() and __cmp__() Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], Tom Cole wrote: In Java, classes can implement the Comparable interface. This interface contains only one method, a

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-29 Thread Joachim Durchholz
Jim Gibson schrieb: The problem addressed by what is know in Perl as the 'Schwartzian Transform' is that the compare operation can be an expensive one, regardless of the whether the comparison uses multiple keys. Since in comparison sorts, the compare operation will be executed N(logN)

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-29 Thread xhoster
Joachim Durchholz [EMAIL PROTECTED] wrote: Jim Gibson schrieb: The problem addressed by what is know in Perl as the 'Schwartzian Transform' is that the compare operation can be an expensive one, regardless of the whether the comparison uses multiple keys. Since in comparison sorts, the

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-29 Thread Gabriel Genellina
At Tuesday 29/8/2006 07:50, Joachim Durchholz wrote: Wikipedia says it's going from 2NlogN to N. If a sort is massively dominated by the comparison, that could give a speedup of up to 100% (approximately - dropping the logN factor is almost irrelevant, what counts is losing that factor of 2).

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-29 Thread Joachim Durchholz
Gabriel Genellina schrieb: At Tuesday 29/8/2006 07:50, Joachim Durchholz wrote: Wikipedia says it's going from 2NlogN to N. If a sort is massively dominated by the comparison, that could give a speedup of up to 100% (approximately - dropping the logN factor is almost irrelevant, what counts

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-29 Thread Tim Peters
[Joachim Durchholz] Wikipedia says it's going from 2NlogN to N. If a sort is massively dominated by the comparison, that could give a speedup of up to 100% (approximately - dropping the logN factor is almost irrelevant, what counts is losing that factor of 2). [Gabriel Genellina] In fact

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-29 Thread Joachim Durchholz
Tim Peters schrieb: [Joachim Durchholz] Wikipedia says it's going from 2NlogN to N. If a sort is massively dominated by the comparison, that could give a speedup of up to 100% (approximately - dropping the logN factor is almost irrelevant, what counts is losing that factor of 2). [Gabriel

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-29 Thread Tim Peters
[Joachim Durchholz] Wikipedia says it's going from 2NlogN to N. If a sort is massively dominated by the comparison, that could give a speedup of up to 100% (approximately - dropping the logN factor is almost irrelevant, what counts is losing that factor of 2). [Gabriel Genellina] In fact

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-29 Thread Fredrik Lundh
Tim Peters wrote: OTOH, current versions of Python (and Perl) just curious, but all this use of ( Perl) mean that the Perl folks have implemented timsort ? /F -- http://mail.python.org/mailman/listinfo/python-list

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-28 Thread William James
[EMAIL PROTECTED] wrote: I would be interested in comments about how Common Lisp, Scheme, and Haskell deal with the decorate-sort-dedecorate technique. %w(FORTRAN LISP COBOL).sort_by{|s| s.reverse} ==[COBOL, FORTRAN, LISP] -- Common Lisp did kill Lisp. Period. ... It is to Lisp what C++

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-28 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Tom Cole wrote: In Java, classes can implement the Comparable interface. This interface contains only one method, a compareTo(Object o) method, and it is defined to return a value 0 if the Object is considered less than the one being passed as an argument, it returns a

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-28 Thread Jim Gibson
In article [EMAIL PROTECTED], Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: In [EMAIL PROTECTED], Tom Cole wrote: In Java, classes can implement the Comparable interface. This interface contains only one method, a compareTo(Object o) method, and it is defined to return a value 0 if

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-28 Thread Dr.Ruud
Jim Gibson schreef: The problem addressed by what is know in Perl as the 'Schwartzian Transform' is that the compare operation can be an expensive one, regardless of the whether the comparison uses multiple keys. Since in comparison sorts, the compare operation will be executed N(logN)

A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-27 Thread [EMAIL PROTECTED]
Last year, i've posted a tutorial and commentary about Python and Perl's sort function. (http://xahlee.org/perl-python/sort_list.html) In that article, i discussed a technique known among juvenile Perlers as the Schwartzian Transform, which also manifests in Python as its “key” optional

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-27 Thread Tom Cole
Well you cross-posted this enough, including a Java group, and didn't even ask about us... What a pity. In Java, classes can implement the Comparable interface. This interface contains only one method, a compareTo(Object o) method, and it is defined to return a value 0 if the Object is