walkccc / CLRS

📚 Solutions to Introduction to Algorithms Third Edition
https://walkccc.me/CLRS
MIT License
4.62k stars 1.25k forks source link

5.3-6 #511

Open Dayal-Kumar opened 1 month ago

Dayal-Kumar commented 1 month ago

I suggest a better solution. Define a new comparator for P which calls to RANDOM(0,1) in case both arguments are equal to break the tie. Rest is same as PERMUTE_BY_SORTING.