Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void selectionSort(int *arr, int n)
- {
- for (int i = 0; i < n - 1; i++)
- {
- int min_id = i;
- for (int j = i + 1; j < n; j++){
- if (arr[j] < arr[min_id])
- min_id = j;
- }
- int temp = arr[min_id];
- arr[min_id] = arr[i];
- arr[i] = temp;
- //if(i%10000==0) cout<<"Selection sort: "<<i<<"/"<<n<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement