Mergesort+(algml+példa)

Az összefésülő rendezés algml nyelvre fordítva: code format="xml" 

             <var what='part1'/> <call func='mergesort'> <var what='part2'/> <call func='merge'> <var what='part1'/> <var what='part2'/> <var what='arr'> </do> <do/> </if></do>

<func name='slice'> <var name='arr' type='Array'/> <var name='arr1' type='Array'/> <var name='arr2' type='Array'/> <var name='middle' type='index of arr'> <call func='begin'> <var name='arr'/> <var name='end' type='index of arr'> <call func='begin'> <var name='arr'/> <var name='end'></op> <do>  <var name='end'/> <call func='end'> <var name='arr'/> </op> <do>  <var name='middle'/> </op>  <var name='end'/> </op></op> </do> <call func='sublist'> <var name='arr'> <call func='begin'><var name='arr'/> <var name='middle'> <var name='part1'/>  <var name='middle'/> </op> <call func='sublist'> <var name='arr'> <var name='middle'> <call func='end'><var name='arr'/> <var name='part2'/> </do>

<func name='merge'> <var name='arr1' type='Array'/> <var name='arr2' type='Array'/> <var name='arr' type='Array'/> <var name='pos' type='index of arr'> <call func='begin'><var name='arr'/> <var name='next1' type='index of arr1'> <call func='begin'><var name='arr1'/> <var name='next2' type='index of arr2'> <call func='begin'><var name='arr2'/> <call func='setsize'> <var name='arr'/>  <call func='size'><var name='arr1'/> <call func='size'><var name='arr2'/> </op> <do>   <var name='next1'/> <call func='end'> <var name='arr1'/> </op>  <var name='next2'/> <call func='end'> <var name='arr2'/> </op> </op> <do> <if>    <var name='arr1'/> <var name='next1'/> </op>  <var name='arr2'/> <var name='next2'/> </op> </op>  <call func='end'><var name='arr2'/> <var name='next2'/> </op> </op> <do>  <var name='arr1'/> <var name='next1'/> </op> <op func='index'> <var name='arr'/> <var name='pos'/> </op> <op func='inc'><var name='next1'/></op> </do> <do> <op func='index'> <var name='arr2'/> <var name='next2'/> </op> <op func='index'> <var name='arr'/> <var name='pos'/> </op> <op func='inc'><var name='next2'/></op> </do> </if> <op func='inc'><var name='pos'/></op> </do> </do>

code