Tim Peters <t...@python.org> added the comment:

No, there's no requirement that run lengths on the stack be ordered in any way 
by magnitude.  That's simply one rule timsort uses, as well as 2-merge and 
various other schemes discussed in papers.  powersort has no such rule, and 
that's fine.

Regardless, rules must be such that the max stack size is at worst logarithmic 
in the number of array elements.  It's also nice if it's obvious that a 
sequence of equal-length runs will lead to perfectly balanced merges, which is 
"obvious enough" with the timsort and 2-merge rules.  It also happens to be 
true of the powersort rules, but harder to see from staring at code because 
it's hard to compute "node powers" in one's head.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34561>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to