#include
using namespace std;
int main() {
// cout<<“Hello World!”;
//Pivot Element in an Sorted Array
int a[]={6,7,1,2,3,4,5};
int n=sizeof(a)/sizeof(int);
int s=0;
int e=n-1;
int mid=(s+e)/2;
while(s<=e)
{
int mid=(s+e)/2;
if(mid<e && a[mid]>a[mid+1])
{
cout<<mid<<" “;
}
if(mid>s && a[mid]<a[mid-1])
{
cout<<mid-1<<” ";
}
if(a[s]>=a[mid])
{
e=mid-1;
}
else
{
s=mid+1;
}
}
if(s>e)
{
cout<<“Pivot Element is not there.”<<endl;
}
}