# 333eb32b3e76025cca17fb10c55d14c66ed9586edd047147ba58053ee4a0b5e0 Elan 1.6.2 guest default_profile valid

main
  variable li set to example.asList()
  call inPlaceRippleSort(li)
  print li
end main

procedure inPlaceRippleSort(out arr as List<of Int>)
  variable changes set to true
  variable lastComp set to arr.length() - 2
  repeat
    set changes to false
    for i from 0 to lastComp step 1
      if arr[i] > arr[i + 1] then
        let temp be arr[i]
        call arr.putAt(i, arr[i + 1])
        call arr.putAt(i + 1, temp)
        set changes to true
      end if
    end for
    set lastComp to lastComp - 1
  end repeat when not changes
end procedure

constant example set to {3, 6, 1, 0, 99, 4, 67}
