So I looked for information about the algorithm in some pages and I found this:
I failed. Becouse I only got a sublist order, but not the full list.
So I looked again for more information and then I made this code:
This code works fine, and I tried to implement threads, but it's a little hard.