Does a one pass solution exist in a problem of sorting an array containing only 0s, 1s, 2s, and 3s?

52 Views Asked by At

This is a typical problem requiring you to solve it in one-pass. You are given an array containing only 0s, 1s, and 2s. You are required to sort the array in one pass in O(1) auxiliary space. I was wondering if such one pass solutions exist for arrays containing more distinct values, and what is the limit of a number of distinct values to which one pass solutions exist.

0

There are 0 best solutions below