Skip to content

Instantly share code, notes, and snippets.

@lettergram
Created March 18, 2015 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lettergram/8c11886ff1d504c5e061 to your computer and use it in GitHub Desktop.
Save lettergram/8c11886ff1d504c5e061 to your computer and use it in GitHub Desktop.
Merge Sort on Slide
// Runs MergeSort algorithm on a slice single
func MergeSort(slice []int) []int {
if len(slice) < 2 {
return slice
}
mid := (len(slice)) / 2
return Merge(MergeSort(slice[:mid]), MergeSort(slice[mid:]))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment