Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Pseudo-code for a simple sorting algorithm.
- # For each position on the list, runs through
- # the remainder of the list and swaps when
- # a smaller element is encountered.
- sort(list) {
- size = array_size(numbers)
- i, k
- for i in [1, size] {
- for k in [i+1, size] {
- if numbers[i] > numbers[k]
- then swap(numbers, i, k)
- }
- }
- return numbers
- }
Add Comment
Please, Sign In to add comment