Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
28
Task/Sort-stability/Liberty-BASIC/sort-stability.basic
Normal file
28
Task/Sort-stability/Liberty-BASIC/sort-stability.basic
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
randomize 0.5
|
||||
N=15
|
||||
dim a(N,2)
|
||||
|
||||
for i = 0 to N-1
|
||||
a(i,1)= int(i/5)
|
||||
a(i,2)= int(rnd(1)*5)
|
||||
next
|
||||
|
||||
print "Unsorted by column #2"
|
||||
print "by construction sorted by column #1"
|
||||
for i = 0 to N-1
|
||||
print a(i,1), a(i,2)
|
||||
next
|
||||
|
||||
sort a(), 0, N-1, 2
|
||||
print
|
||||
|
||||
print "After sorting by column #2"
|
||||
print "Notice wrong order by column #1"
|
||||
for i = 0 to N-1
|
||||
print a(i,1), a(i,2),
|
||||
if i=0 then
|
||||
print
|
||||
else
|
||||
if a(i,2) = a(i-1,2) AND a(i,1) < a(i-1,1) then print "bad order" else print
|
||||
end if
|
||||
next
|
||||
Loading…
Add table
Add a link
Reference in a new issue