Given an unsorted array find an entry in array where arr[i]= i; modified it to if array is sorted.
Answers
Answered by
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
English,
5 months ago
Math,
5 months ago
Science,
5 months ago
Computer Science,
10 months ago
Computer Science,
10 months ago
English,
1 year ago