Skip to content

Commit

Permalink
Typo Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dynamitechetan committed Nov 10, 2016
1 parent 9c6990b commit 6731558
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions Shellosort.go → ShellSort.go
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
package main


import "fmt"
import "math/rand"
func main() {
arr := RandomArray(10)
fmt.Println("Initial array is:", arr)
fmt.Println("")

for d := int(len(arr)/2); d > 0; d /= 2 {
for i := d; i < len(arr); i++ {
for j := i; j >= d && arr[j-d] > arr[j]; j -= d {
arr[j], arr[j-d] = arr[j-d], arr[j]
}
}
}

fmt.Println("Sorted array is: ", arr)
}
func RandomArray(n int) []int {
arr := make([]int, n)
for i := 0; i <= n - 1; i++ {
arr[i] = rand.Intn(n)
}
return arr
package main


import "fmt"
import "math/rand"
func main() {
arr := RandomArray(10)
fmt.Println("Initial array is:", arr)
fmt.Println("")

for d := int(len(arr)/2); d > 0; d /= 2 {
for i := d; i < len(arr); i++ {
for j := i; j >= d && arr[j-d] > arr[j]; j -= d {
arr[j], arr[j-d] = arr[j-d], arr[j]
}
}
}

fmt.Println("Sorted array is: ", arr)
}
func RandomArray(n int) []int {
arr := make([]int, n)
for i := 0; i <= n - 1; i++ {
arr[i] = rand.Intn(n)
}
return arr
}

0 comments on commit 6731558

Please sign in to comment.