http://play.golang.org/p/icQO_bAZNE
I am practicing sort using heap but
prog.go:85: type bucket is not an expression
prog.go:105: cannot use heap.Pop(bucket[i].([]IntArr)) (type interface {}) as type int in assignment: need type assertion
[process exited with non-zero status]
I am getting those errors and can't figure out how to type assert properly
The problem is from the lines:
heap.Push(bucket[x].([]IntArr), elem)
arr[index] = heap.Pop(bucket[i].([]IntArr))
Because I want to use heap structure in order to extract values from each bucket
And each bucket is []IntArr
And IntArr
is []int
like the following
type IntArr []int
type bucket [10]IntArr
I have been trying many ways over the weekend and can't figure out, I greatly appreciate it.