Beispiel #1
0
int main() {
    auto v = std::vector<int>{ 2, 1, 2, 1, 0, 2, 0, 0, 2, 2, 1, 1, 0, 1, 0, 1 };
    sort012(v);
    for (auto &it : v) {
        std::cout << it << ' ';
    }
    return 0;
}
Beispiel #2
0
int main()
{
  int arr[] = {0, 1, 1, 0, 1, 2, 1, 2, 0, 0, 0, 1};
  int arr_size = sizeof(arr)/sizeof(arr[0]);
  int i; 
  sort012(arr, arr_size); 
  printf("array after segregation ");
  printArray(arr, arr_size); 
  getchar();
  return 0;
}