``` i := sort.Search(len(arr), func(i int) bool { return arr[i] > x })
``` arr = append(arr, 0)
``` copy(arr[i+1:], arr[i:])
``` arr[i] = x
``` return arr
``` }
arr is large enough
copy
is O(n), in that code, and in any other code.
2 Likes
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.