[Libre-soc-bugs] [Bug 659] SVP64 demo / unit test of CRM data-dependent ffirst mode implementing insertion sort
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Wed Jul 21 16:35:46 BST 2021
https://bugs.libre-soc.org/show_bug.cgi?id=659
--- Comment #3 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
actual core of timsort looks very similar to a butterfly
schedule. note that min_run is picked to ensure merges are
as close to equal size power 2 as possible.
def timsort(array):
min_run = 32
n = len(array)
for i in range(0, n, min_run):
insertion_sort(array, i, min((i + min_run - 1), n - 1))
size = min_run
while size < n:
for start in range(0, n, size * 2):
midpoint = start + size - 1
end = min((start + size * 2 - 1), (n-1))
merged_array = merge(
left=array[start:midpoint + 1],
right=array[midpoint + 1:end + 1])
array[start:start + len(merged_array)] = merged_array
size *= 2
return array
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list