Sorting Question

Правка en1, от code_fille, 2015-06-22 19:53:14

Given an array of 3 different colored balls, we have to sort it using minimum number of swaps. It could be done in O(n) using 3-pointers and two traversals(one to count no. of occurrences of each color and other to sort). Could this be implemented in one traversal(count is not known before).

Теги sorting

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский code_fille 2015-06-22 19:53:14 310 Initial revision (published)