Created
February 21, 2023 14:14
-
-
Save BennoCrafter/373bd5bf389a294a0dec3fd6a434c399 to your computer and use it in GitHub Desktop.
simple bubble sort with oasis
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
do( | |
define(arr, "289435028342847959"), | |
define(n, len(arr)), | |
define(swapped, "true"), | |
while(==(swapped, "true"), | |
do( | |
define(swapped, "false"), | |
define(i, 0), | |
while(<(i, -(n,1)), | |
do( | |
if(>(charAt(arr,i), charAt(arr, +(i,1))), | |
do( | |
define(temp, charAt(arr,i)), | |
define(arr, replace(arr, i, charAt(arr, +(i,1)))), | |
define(arr, replace(arr, +(i,1), temp)), | |
define(swapped, "true") | |
) | |
), | |
define(i, +(i,1)) | |
) | |
), | |
define(i, -(i,1)) | |
) | |
), | |
out(arr) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment