Created
September 16, 2016 12:16
-
-
Save valexey/e559764622f1b35ce9da799dbcc9e286 to your computer and use it in GitHub Desktop.
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
MODULE BubbleTest; | |
CONST n = 40000; | |
PROCEDURE DoIt*; | |
VAR | |
arr : ARRAY n OF INTEGER; | |
time : INTEGER; | |
i, j, tmp : INTEGER; | |
BEGIN | |
FOR i:=0 TO n-1 DO | |
arr[i] := n-i; | |
END; | |
FOR i:=0 TO n-1 DO | |
FOR j:=0 TO n-2-i DO | |
tmp := arr[j]; | |
IF arr[j] > arr[j+1] THEN | |
arr[j] := arr[j+1]; | |
arr[j+1] := tmp; | |
END; | |
END; | |
END; | |
END DoIt; | |
BEGIN | |
DoIt(); | |
END BubbleTest. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment