GithubHelp home page GithubHelp logo

wikisort's Introduction

WikiSort

Note: if you want to coordinate your progress with other developers, check out /r/BlockMergeSort on Reddit.

Also, an updated version of their paper from 2011 is now available here!

======

WikiSort is a stable bottom-up in-place merge sort based on the work described in "Ratio based stable in-place merging", by Pok-Son Kim and Arne Kutzner [PDF]. Kim's and Kutzner's algorithm is a stable merge algorithm with great performance characteristics and proven correctness, but no attempt at adapting their work to a stable merge sort apparently existed. This is one such attempt!

What separates this from those other in-place merge papers?
Dr. Kutzner's and Dr. Kim's paper addresses this, but many of the papers define algorithms that are unstable, impractical (as in too slow to be of general use), or theoretical. Their paper is one of the few to provide a full implementation for a fast and stable in-place merge, and the published performance results were promising.

Head-to-head
  • 80-90% of the speed of libc++'s stable_sort() for highly random input with fewer than ~10 million elements.
  • Starts to exceed stable_sort()'s performance for larger arrays (not yet sure why – needs more research).
  • Up to 10x faster when the data is already partially sorted or otherwise has a less-than-random distribution.
  • 3-15x faster than inplace_stable_sort(), which is libc++'s equivalent O(1) sort function.

If you want to know how it works, check out the documentation:
  • Chapter 1: Tools
  • Chapter 2: Merging
  • Chapter 3: In-Place
  • Chapter 4: Faster!

WikiSort is fast, stable, uses O(1) memory, and public domain! It will also change as superior techniques become known – if you see something in the algorithm that could be improved, please flag the issue!

C, C++, and Java versions are currently available. Please note that while it is already highly practical, it is not yet a 100% implementation of their work.

Quick extra note: If you're wondering what to call this type of sort, the authors suggested "block merge-sort", as it would fit the existing pattern of "heap sort" and "weak heap sort". I guess KimSort is a no-go.

wikisort's People

Contributors

cusell avatar whackashoe avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.