func Sort(p uint) bool { n := uint64(1 << p) increasing := &Increasing{} funnelsort.NewItem = newItem funnelsort.FunnelSort(&Random{n}, increasing) return increasing.outOfOrder }
func Sort(r io.Reader, w TweetWriter) { runtime.GOMAXPROCS(runtime.NumCPU()) funnelsort.NewItem = NewItem br := bufio.NewReaderSize(r, 1<<24) in := NewTweetReader(br) funnelsort.FunnelSort(in, w) }
func TestFunnelSort(t *testing.T) { n := uint64(1 << 14) increasing := &Increasing{} funnelsort.NewItem = newItem funnelsort.FunnelSort(&Random{n}, increasing) if increasing.outOfOrder { t.Error("output not sorted") t.FailNow() } }