Cycle sort works as follows:

Implement cycle sort. Also determine its time complexity in big-O notation. Can you imagine any advantage of cycle sort?

Note: Cycle sort has two things that you have to be aware of:

Note: The submission of this exercise is in markdown and therefore won’t be tested. Use your preferred code editor or Papyrus1 to test your code.