The FASTEST sorting algorithm: Part 3 - Merging runs efficiently
Автор: Gaurav Sen
Загружено: 2018-10-22
Просмотров: 15769
This video from the Tim Sort series focuses on making the intermediate merge operations efficient. The Tim Sort algorithm performance is heavily dependent on merging sorted arrays efficiently.
A merge operation uses auxiliary memory equal to the size of the smaller chunk/run. This is an improvement over the standard Merge Sort approach which constructs the sorted array outside the other two arrays being merged.
Another optimisation in the algorithm is using a program stack instead of the system stack. This avoids recursive calls and allows us to choose which two runs to merge.
The final improvement is to optimise the sizes of the merging arrays. This is done by using invariants in the stack, making the stack sorted in ascending order of lengths downwards.
The final video will be on using some artificial intelligence to merge runs even more efficiently!
References:
Java: http://cr.openjdk.java.net/~martin/we...
Article: https://bugs.python.org/file4451/tims...
Social links:
Facebook: / gkcs0
Quora: https://www.quora.com/profile/Gaurav-...
LinkedIn: / gaurav-sen-56b6a941
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: