Insert an element at position i:
func insert(s []int, i int, v int) []int {
s = append(s, 0)
copy(s[i+1:], s[i:])
s[i] = v
return s
}
First grow the slice, then shift elements right, then set the value. Insertion is O(n) because of the shifting.