Computer Science, asked by gurnoor8098, 11 months ago

Given an unsorted array find an entry in array where arr[i]= i; modified it to if array is sorted.

Answers

Answered by kswami848
0

Answer:

..

Explanation:

int arr[n],I,j;

for(i=n-1;i>0;i--)

{

for(j=0;j<i;j++)

{

int t:

if(arr[j]>arr[j+1])

{

t= arr[j];

arr[j]=arr[j+1];

arr[j+1]=t;

}

}

}

now this is an sorted array.

Similar questions