Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A merge sort of list with O(1) memory overhead #219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Oct 10, 2021

  1. A merge sort of list with O(1) memory overhead

    This change solves the sort_list problem without recursion,
    which reduces its memory usage from O(log N) to O(1).
    
    It merges the data in a bottom up fashion, by building sorted
    runs of length 1, 2, 4, 8, etc. The sorted runs are put onto
    two lists alternatively so that it makes the next iteration of
    sorting easier.
    
    It also runs about 40% faster than the previous solution based
    on the average run time printed by "make sort_list".
    wew036 committed Oct 10, 2021
    Configuration menu
    Copy the full SHA
    b1028b7 View commit details
    Browse the repository at this point in the history