Compare commits
2 Commits
1ac4bf24bc
...
c12d2d91a1
Author | SHA1 | Date |
---|---|---|
raul | c12d2d91a1 | |
raul | f82ec16975 |
|
@ -0,0 +1,24 @@
|
||||||
|
# ---> Go
|
||||||
|
# If you prefer the allow list template instead of the deny list, see community template:
|
||||||
|
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||||
|
#
|
||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.txt
|
||||||
|
|
||||||
|
# Test binary, built with `go test -c`
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
|
*.out
|
||||||
|
|
||||||
|
# Dependency directories (remove the comment below to include it)
|
||||||
|
# vendor/
|
||||||
|
|
||||||
|
# Go workspace file
|
||||||
|
go.work
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
FILE="./array-sorter"
|
||||||
|
|
||||||
echo {1..300} > ./numbers.txt
|
echo {1..300} > ./numbers.txt
|
||||||
cat ./numbers.txt | tr ' ' "\\n" | shuf | tr "\\n" ' ' > ./random.txt
|
cat ./numbers.txt | tr ' ' "\\n" | shuf | tr "\\n" ' ' > ./random.txt
|
||||||
go run . $(cat ./random.txt)
|
if test -f ./array-sorter; then
|
||||||
|
echo "$FILE exists, running"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "$FILE doesn't exist, building"
|
||||||
|
go build -o $FILE .
|
||||||
|
fi
|
||||||
|
./array-sorter $(cat ./random.txt)
|
||||||
|
|
|
@ -43,7 +43,9 @@ func sorter(arr []float64) (orderedArr []float64) {
|
||||||
//var numValue float64
|
//var numValue float64
|
||||||
sliced_arr := arr
|
sliced_arr := arr
|
||||||
|
|
||||||
// TODO: get the actual sorting working
|
// IT WAS THIS BASTARD WHO KEPT CAUSING OUT OF BOUNDS ERRORS
|
||||||
|
// I KEPT READING THE LENGTH OF THE ORIGINAL ARRAY INSTEAD OF THE
|
||||||
|
// ARRAY BEING SLOWLY EMPTIED
|
||||||
for i := 0; i < len(sliced_arr); {
|
for i := 0; i < len(sliced_arr); {
|
||||||
// fmt.Printf("Current slice length: %v\n", sliced_arr)
|
// fmt.Printf("Current slice length: %v\n", sliced_arr)
|
||||||
// fmt.Println(orderedArr)
|
// fmt.Println(orderedArr)
|
||||||
|
|
Loading…
Reference in New Issue