Maximum difference between adjacent elements of list: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
|||
Line 17: | Line 17: | ||
see "Output:" + nl |
see "Output:" + nl |
||
sList = [2,-3,0,1,1,-2.3,0,5.5,8,6,2,9,11,8,1] |
sList = [2,-3,0,1,1,-2.3,0,5.5,8,6,2,9,11,8,1] |
||
oldDiff = fabs(sList[1]-sList[2]) |
|||
first = sList[1] |
|||
second = sList[2] |
|||
sortList = [] |
sortList = [] |
||
add(sortList,[oldDiff,first,second]) |
|||
for n = 1 to len(sList)-1 |
for n = 1 to len(sList)-1 |