diff --git a/Algorithms/insertion_sort.go b/Algorithms/insertion_sort.go new file mode 100644 index 0000000..8b8c2c5 --- /dev/null +++ b/Algorithms/insertion_sort.go @@ -0,0 +1,12 @@ +package main + +func insertionSort(list []int) []int { + for i := 0; i < len(list); i++ { + for j := i + 1; j < len(list); j++ { + if list[j] < list[i] { + list[i], list[j] = list[j], list[i] + } + } + } + return list +}