ArrayList Imp do rekurencji

function sortHalf(List listToSort, value x):
    List firstHalf;
    List secondHalf;
    for (Integer i in listToSort):
        if i less than x then firstHalf.add(i);
        else if i greater than x then secondHalf.add(i);
    loop
    List finalList;
    finalList.addAll(firstHalf);
    finalList.addAll(secondHalf);
    return finalList;
end
Average Anaconda