Posted: Wed Jan 28, 2004 6:51 pm
if the elements of array can appear more than once
Example : 333212211
How to solve it ?
Example : 333212211
How to solve it ?
The Online Judge board
https://onlinejudge.org/board/
There's no need to sort.. just count.Sayutee wrote:Well, I think a simple "Selection Sort" is Enough to get the minimum swaps (Someone please tell me if I am wrong!)
The Selection Sort will also solve the problem with Repeating numbers.