summaryrefslogtreecommitdiff
path: root/exercises/1.2-2/main.go
blob: 2746d7a6d43cfce578184dc0d4f5e00b7365e953 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import (
	"fmt"
	"math"
)

func main() {
	fmt.Println("n,isort,msort")

	for n := 2.0; n < 1000.0; n++ {
		isort := 8 * math.Pow(n, 2)
		msort := 64 * (n * math.Log2(n))

		fmt.Printf("%v,%v,%v\n", n, isort, msort)
		if isort > msort {
			break
		}
	}
}