Skip to content

Commit 6731558

Browse files
Typo Fixed
1 parent 9c6990b commit 6731558

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
package main
2-
3-
4-
import "fmt"
5-
import "math/rand"
6-
func main() {
7-
arr := RandomArray(10)
8-
fmt.Println("Initial array is:", arr)
9-
fmt.Println("")
10-
11-
for d := int(len(arr)/2); d > 0; d /= 2 {
12-
for i := d; i < len(arr); i++ {
13-
for j := i; j >= d && arr[j-d] > arr[j]; j -= d {
14-
arr[j], arr[j-d] = arr[j-d], arr[j]
15-
}
16-
}
17-
}
18-
19-
fmt.Println("Sorted array is: ", arr)
20-
}
21-
func RandomArray(n int) []int {
22-
arr := make([]int, n)
23-
for i := 0; i <= n - 1; i++ {
24-
arr[i] = rand.Intn(n)
25-
}
26-
return arr
1+
package main
2+
3+
4+
import "fmt"
5+
import "math/rand"
6+
func main() {
7+
arr := RandomArray(10)
8+
fmt.Println("Initial array is:", arr)
9+
fmt.Println("")
10+
11+
for d := int(len(arr)/2); d > 0; d /= 2 {
12+
for i := d; i < len(arr); i++ {
13+
for j := i; j >= d && arr[j-d] > arr[j]; j -= d {
14+
arr[j], arr[j-d] = arr[j-d], arr[j]
15+
}
16+
}
17+
}
18+
19+
fmt.Println("Sorted array is: ", arr)
20+
}
21+
func RandomArray(n int) []int {
22+
arr := make([]int, n)
23+
for i := 0; i <= n - 1; i++ {
24+
arr[i] = rand.Intn(n)
25+
}
26+
return arr
2727
}

0 commit comments

Comments
 (0)