Initial commit
Test (in pplus-core) / in-core (push) Failing after 28m44s

This commit is contained in:
alexm committed 2026-11-12 22:23:48 -05:00
commit 568474d52f
1591 files changed
+528213

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
// An in-place sort with a PROCEDURE and BYREF, plus a loop invariant.
// EXPECT: [1, 2, 3, 5, 8, 9]
PROCEDURE INSERTION_SORT(BYREF L : LIST OF INTEGER)
FOR I <- 1 TO LENGTH(L)
INVARIANT FORALL K IN [1, I) : L[K - 1] <= L[K]
DECLARE Key, J : INTEGER
Key <- L[I]
J <- I - 1
WHILE J >= 0 AND L[J] > Key
L[J + 1] <- L[J]
J <- J - 1
ENDWHILE
L[J + 1] <- Key
NEXT I
ENDPROCEDURE
DECLARE Xs : LIST OF INTEGER
Xs <- [5, 2, 9, 1, 8, 3]
CALL INSERTION_SORT(Xs)
OUTPUT Xs