+ 1
how do are writw the code to arrange the following array in ascending order 200 190 100 96 102 82 122
2 Respostas
+ 2
If you have C++11, following would be one of the most efficient solutions.
#include<algorithm>
// function block begin
int arr[]={200,190 /*rest of elements*/};
std::sort(std:: begin(arr), std::end(arr));
// now the array elements are ascendingly sorted
// function block end
If you want to implement a sorting algorithm yourself, read about quick sort. Otherwise don't try to reinvent the wheel. Use standard library implementations in generic cases like this. They are well optimized.
0
use any of the sorting algorithm ,
you can use the easiest Bubble Sort algorithm to solve it.