Cyclic Sort

anil gurung
1 min readDec 7, 2020

In this blog post, I will be giving a brief description about another important pattern for technical interviews. This pattern is called Cyclic Sort.

This pattern is very useful for solving problems that involves arrays containing numbers in a given range or finding duplicates or missing numbers. In this pattern, we iterate over the given array one number at a time. If the current number that we are iterating is not at the correct index then we swap it with the number at its correct index.

source: hackernoon.com

Identification of this pattern:

This pattern can be identified by following ways;

  1. If the problem involves with a sorted array in a given range,
  2. If the problem involves finding the missing or duplicate number in a sorted or rotated array.

References:

--

--