Last active
December 31, 2019 03:44
-
-
Save alvinmatias69/6eba6690ac2b0f52c05190fa14253ae4 to your computer and use it in GitHub Desktop.
High performance sort that will remove every inappropriate element to create sorted ascending list. Always operate in O(n)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
TEMP=-9999999 | |
for item in "$@" | |
do | |
if [ "$TEMP" -lt "$item" ] | |
then | |
printf "%s " "$item" | |
fi | |
TEMP=$item | |
done | |
echo | |
# ./orba_sort.sh 2 3 1 5 6 2 1 8 | |
# 2 3 5 6 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment