Skip to content

This is a fun side project, it sorts 5 numbers in the optimal 7 comparisons. It uses a linked list structure to keep track of ordering.

Notifications You must be signed in to change notification settings

Timmythetim/7CompSort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

7CompSort

This is a fun side project, it sorts 5 numbers in the optimal 7 comparisons. It uses a linked list structure to keep track of ordering.

The lower bound for sorting 5 numbers is log_2(5!) = 6.9...., which means at best, sorting 5 numbers is possible in 7 comparisons. This implementation uses a linked list to keep track of the comparisons that have been made, and it suceeds in sorting all possible permutations of the array [1,2,3,4,5] in 7 comparisons exactly.

About

This is a fun side project, it sorts 5 numbers in the optimal 7 comparisons. It uses a linked list structure to keep track of ordering.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages