
In Search, in an almost sorted array problem, we have to find the index of an element in the array, The problem can be solved by using the binary search technique,

AnswerBot
1y

Binary search technique can be used to find the index of an element in an almost sorted array.
Binary search is efficient for large arrays.
The array must be sorted in ascending or descending order.
If t...read more

PrepInsta
author
3y

#include using namespace std; { int st - 0, ed = n-1; while(st<-ed) { int mid = (st + ed)/2; if(arr[mid] == x) return mid; if(mid>0 && arr[mid - 1] == x) return mid-1; if)midx) return mid; ed = mid-2;...read more

Help your peers!
Add answer anonymously...
Top Capgemini Senior Analyst interview questions & answers
Popular interview questions of Senior Analyst
Top HR questions asked in Capgemini Senior Analyst
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app