pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/JamesQuintero/ShiftSort

sorigen="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/repository-6534fbc3f5e83ac0.css" /> GitHub - JamesQuintero/ShiftSort: Sorting algorithm quicker than MergeSort, and is adaptive and stable. · GitHub
Skip to content

Repository files navigation

ShiftSort

Codacy Badge

Preview

ShiftSort is a stable, adaptive, divide-and-conquer sorting algorithm. When the list is already partily sorted, Shiftsort beats any other sorting algorithm.

It’s similar to Merge Sort, but is more selective on what it merges. Merge Sort splits its array in half continuously until reaching its base case of 2 elements, swaps if needed, and then merges as it returns. Shift Sort uses a derivative array to split in half continuously until reaching a base case of 2 or 3 elements, uses the results to determine what parts of the array to merge, and then merges as it returns.

Shift Sort time and space complexities:

Complexity BigO
Best O(n)
Average O(nlogn)
Worst O(nlogn)
Space n

Shift Sort has a best-case time complexity of O(n) because it uses a secondary list, and if the secondary list is empty, the array is already sorted and the algorithm stops after n iterations. Shift Sort’s O(n) beats Merge Sort’s O(nlogn). Shift Sort’s average-case complexity is the same as Merge Sort’s, but in real world testing, Shift Sort out performs Merge Sort. For space, at worst, Shift Sort will initialize a second and third list of about n/2, putting the total at n.

Main parts of Shift Sort:

  1. Derivative List Creation
  2. Splitting of Derivative list
  3. Merging Sublists

See ShiftSort-Analysis.pdf for step-by-step on Shift Sort's inner workings

About

Sorting algorithm quicker than MergeSort, and is adaptive and stable.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy