+ 3
Write a programme to check whether the array is sorted in ascending order or not?
A array is given with some elements in it. You just have to check is it in ascending order or not? if yes then print "true"...
7 Réponses
+ 8
// basic algo layout:
bool isAscend = true;
for (int i = 0; i < array_size - 1; i++)
{
if (array[i] > array[i + 1])
{
isAscend = false; break;
}
}
return isAscend;
+ 8
You may refer to this site for all kinds of algorithms, including array sorting ones. I use bubble-sorting, but it's not the most efficient way. :3
http://bigocheatsheet.com
+ 5
nyc logic @Hatsy Rei
n one more thing
if we need to sort
then??
+ 5
coders never ask for which language
they just push algorithm...
@Limitless
😂😂😂
+ 4
wow #kamakshi...
clapping
+ 2
What programming language?
+ 2
I tried like this
https://code.sololearn.com/cax56CIFQ3Lr/?ref=app