File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ import (
8
8
"time"
9
9
)
10
10
11
- func shuffle (a * []int ) {
12
- for i := len (* a ) - 1 ; i > 0 ; i -- {
11
+ func shuffle (a []int ) {
12
+ for i := len (a ) - 1 ; i > 0 ; i -- {
13
13
j := rand .Intn (i + 1 )
14
- ( * a ) [i ], ( * a ) [j ] = ( * a ) [j ], ( * a ) [i ]
14
+ a [i ], a [j ] = a [j ], a [i ]
15
15
}
16
16
}
17
17
@@ -24,15 +24,15 @@ func isSorted(a []int) bool {
24
24
return true
25
25
}
26
26
27
- func bogoSort (a * []int ) {
28
- for ! isSorted (* a ) {
27
+ func bogoSort (a []int ) {
28
+ for ! isSorted (a ) {
29
29
shuffle (a )
30
30
}
31
31
}
32
32
33
33
func main () {
34
34
rand .Seed (time .Now ().UnixNano ())
35
35
a := []int {1 , 3 , 4 , 2 }
36
- bogoSort (& a )
36
+ bogoSort (a )
37
37
fmt .Println (a )
38
38
}
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ func leftMostPoint(points []point) point {
21
21
}
22
22
23
23
func (p point ) equal (o point ) bool {
24
- return p .x == o .x && p .y == o .x
24
+ return p .x == o .x && p .y == o .y
25
25
}
26
26
27
27
func counterClockWise (p1 , p2 , p3 point ) bool {
You can’t perform that action at this time.
0 commit comments