You are viewing a single comment's thread. Return to all comments →
Have to compare ascending/descending order because we have to get minimum swap count.
They have different swap count so you have to print smaller one.
I used cycle algorithm for counting it.
you can reference below site.
http://www.geeksforgeeks.org/minimum-number-swaps-required-sort-array/
Seems like cookies are disabled on this browser, please enable them to open this website
Lily's Homework
You are viewing a single comment's thread. Return to all comments →
Have to compare ascending/descending order because we have to get minimum swap count.
They have different swap count so you have to print smaller one.
I used cycle algorithm for counting it.
you can reference below site.
http://www.geeksforgeeks.org/minimum-number-swaps-required-sort-array/