func main() { rand.Seed(time.Now().UTC().UnixNano()) var list cslib.List // 1. Insert 10 integers and print them out in order. fmt.Println("Exercise 1:") list = &cslib.LinkedList{} for i := 0; i < 10; i++ { list.Append(i) } list.Traverse(func(x int) { fmt.Printf("%d ", x) }) fmt.Println() // The remaining exercises we run for a variety of different list types. // 2. For n = 100, ..., X, time the following operations: fmt.Println("\nExercise 2:") for i := 2; i <= 5; i++ { // Size of list. n := int(math.Pow(10, float64(i))) fmt.Printf("n = %d\n", n) list = &cslib.LinkedList{} testList("LinkedList", n, list) list = &cslib.ArrayList{Growth: 1.1} testList("ArrayList(1.1)", n, list) list = &cslib.ArrayList{Growth: 1.5} testList("ArrayList(1.5)", n, list) list = &cslib.ArrayList{Growth: 2.0} testList("ArrayList(2.0)", n, list) } }