diff options
| author | Paul Buetow <paul@buetow.org> | 2020-07-14 09:34:50 +0100 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2020-07-14 09:34:50 +0100 |
| commit | aee630b03f48a9f528a4a50e9dcb0fdc8ef20aa5 (patch) | |
| tree | 152644259dd29dee9dac930cca9f26e4b9422112 /sort/sorted.go | |
| parent | 554a7a259f3feefb586374ac5a3b57acc99a4446 (diff) | |
add bench helper
Diffstat (limited to 'sort/sorted.go')
| -rw-r--r-- | sort/sorted.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sort/sorted.go b/sort/sorted.go new file mode 100644 index 0000000..a24de19 --- /dev/null +++ b/sort/sorted.go @@ -0,0 +1,12 @@ +package sort + +import "algorithms/ds" + +func Sorted(a []ds.Comparer) bool { + for i := len(a) - 1; i > 0; i-- { + if a[i].LowerThan(a[i-1]) { + return false + } + } + return true +} |
