I'm trying to implement a simple merge sort using an auxiliary array. I have type byString []string
that implements the Less, Swap, and Len
methods. It's basically following Go's sort
package's interface.
However, I'm having some difficulty choosing the best route to copy the byString
slice to a temporary array.
Please help me break out of Java's polymorphism world to make it work with Go.
func merge(data Interface, lo, mid, hi int) {
i, j := lo, mid+1
// How do I copy data's elements to a new slice called aux?
}