I try to recreate modified quicksort from here https://link.springer.com/chapter/10.1007/978-981-15-6648-6_26#enumeration
the code give this error RecursionError: max