Ejemplo n.º 1
0
func main() {
	meow := meow_sort.RandArray(10)
	fmt.Println("Given array is: ", meow)
	fmt.Println("")
	for ig_ig := int(len(meow) / 2); ig_ig > 0; ig_ig /= 2 {
		for x := ig_ig; x < len(meow); x++ {
			for xx := x; xx >= ig_ig && meow[xx-ig_ig] > meow[xx]; xx -= ig_ig {
				meow[xx], meow[xx-ig_ig] = meow[xx-ig_ig], meow[xx]
			}
		}
	}
	fmt.Println("Sorted array is: ", meow)
}
Ejemplo n.º 2
0
func main() {
	meow := meow_sort.RandArray(10)
	fmt.Println("Given array is: ", meow)
	fmt.Println("")
	temp := 0

	for x := 0; x < len(meow); x++ {
		for xx := 0; xx < len(meow)-1; xx++ {
			if meow[xx] > meow[xx+1] {
				temp = meow[xx]
				meow[xx] = meow[xx+1]
				meow[xx+1] = temp
			}
		}
	}
	fmt.Println("Sorted array is: ", meow)
}
Ejemplo n.º 3
0
func main() {
	meow := meow_sort.RandArray(10)
	fmt.Println("Given array is: ", meow)
	fmt.Println("")

	var minimum int = 0
	var temp int = 0

	for x := 0; x < len(meow); x++ {
		minimum = x
		for xx := x + 1; xx < len(meow); xx++ {
			if meow[xx] < meow[minimum] {
				minimum = xx
			}
		}
		temp = meow[x]
		meow[x] = meow[minimum]
		meow[minimum] = temp
	}
	fmt.Println("Sorted array is: ", meow)
}
Ejemplo n.º 4
0
func main() {
	meow := meow_sort.RandArray(10)
	fmt.Println("Given array is: ", meow)
	fmt.Println("")
	fmt.Println("Sorted Array is: ", quick(meow))
}