// program for codechef UNCLE JOHNY
#include <stdio.h>
int main()
{
int t,pos,i,ujp,j;
unsigned long int n;
int arr[n];
int high=n,low=0,mid;
scanf("%d",&t);
while (t)
{
scanf ( "%ld",&n);
low=0;
high=n;
mid=(high+low)/2;
for (i=0; i<n; i++ )
{
scanf("%d",&arr[i]);
}
scanf ("%d",&ujp); //pos. pf uj in unsorted array
//uj=arr[ujp-1];
for (j=0; j<n-1 ; j++)
{
for (i=0; i<n-1-j; i++)
{
if ( arr[i]>arr[i+1] )
{
arr[i]=arr[i]+arr[i+1];
arr[i+1]=arr[i]-arr[i+1];
arr[i]=arr[i]-arr[i+1];
}
}
}
while ( low<=high )
{
if ( arr[mid]==arr[ujp])
{
pos=mid;
break;
}
else if ( arr[mid] > arr[ujp] )
{
high=mid-1;
mid=(low+high)/2;
}
else
{
low=mid+1;
mid=(low+high)/2;
}
}
printf("%d\n",pos+1 );
t--;
}
}
plzz guys…tell me where is the segmentation fault.