educative.io

Educative

Why this pattern is called "Cyclic sort". Can we add that description too?

Was kinda mystery to me until I Googled.

Cheers

Hi, @Gaurav7
It has been written in the lesson that
" If we iterate the array one number at a time, and if the current number we are iterating is not at the correct index, we swap it with the number at its correct index. This way, we will go through all numbers and place them at their correct indices, hence, sorting the whole array."

Also, it has been demonstrated in the illustration.

If you need further assistance, feel free to write below.
Hope this helps.