Last list item: Difference between revisions

Line 490:
 
=={{header|Ring}}==
===WithoutWith sorting===
<lang ring>
see "working..." + nl
 
Line 499:
while true
n++
firstList = minsort(List)
first = List[1]
second = List[2]
ind1 = find(List,first)
del(List,ind1)
second = min(List)
ind2 = find(List,second)
del(List,if ind1 < ind2)
del(List,ind2)
del(List,ind1)
else
del(List,ind1)
del(List,ind2)
ok
sum = first + second
add(List,sum)
Line 536 ⟶ 542:
see txt + nl
</lang>
===WithWithout sorting===
<lang ring>
see "working..." + nl
 
Line 545 ⟶ 551:
while true
n++
Listfirst = sortmin(List)
first = List[1]
second = List[2]
ind1 = find(List,first)
del(List,ind1)
second = min(List)
ind2 = find(List,second)
if ind1 < del(List,ind2)
del(List,ind2)
del(List,ind1)
else
del(List,ind1)
del(List,ind2)
ok
sum = first + second
add(List,sum)
2,468

edits