def METHOD_NAME(nodes, rindex):
    count = [0 for i in range(len(nodes))]
    for i in range(len(rindex)):
        cindex = len(nodes) - 1 - rindex[i]
        count[cindex] += 1
    for i in range(1, len(count)):
        count[i] += count[i - 1]
    output = [None for i in range(len(nodes))]
    for i in range(len(output)):
        cindex = len(nodes) - 1 - rindex[i]
        # Attn! We're sorting in reverse
        output_index = len(output) - count[cindex]
        output[output_index] = nodes[i]
        count[cindex] -= 1
    return output