heap_sort_test

  • 2022-12-14
  • 浏览 (489)

heap_sort_test.go 源码

package sort

import (
	"fmt"
	"math/rand"
	"testing"
	"time"
)

func TestHeapSort(t *testing.T) {
	var zero []int
	HeapSort(zero)
	fmt.Println(zero)

	one := []int{1}
	HeapSort(one)
	fmt.Println(one)

	two := []int{5, 5, 3, 3, 3, 3, 3, 3}
	HeapSort(two)
	fmt.Println(two)

	var data []int
	rand.Seed(time.Now().Unix())

	for i := 0; i < length; i++ {
		data = append(data, rand.Intn(1000))
	}
	HeapSort(data)

	fmt.Println(data)
}

你可能感兴趣的文章

bubbleSort

bubbleSort_test

bucket_sort

0  赞