You are given a sorted array containing only numbers 0 and 1. Find the transition point efficiently. Transition point is a point where "0" ends and "1" begins.
Answers
Answered by
0
ykyyyyyyyyyyyy the same time
Answered by
0
let the array be int a[ ] of size n
then,
int a [ ] =new int[n];
int search=1;
int position = -1;
for(int i=0;i<n;i++)
{
if(a[i] == search)
{
position= i;
break;
}
else
continue;
}
System. out println("Transition point =" +position) ;
Atharv91:
Hope it helps :)
Similar questions