int ara(int dizi[], int ilk, int son, int deger) {
int indeks;
if ( ilk > son )
return 0;
indeks = (ilk + son) / 2;
if ( dizi[indeks] < deger )
return ara(dizi, indeks+1, son, deger);
else if ( dizi[indeks] > deger )
return ara(dizi, ilk, indeks-1, deger);
else
return 1;
}
for (i=1; i<2*n; i++) {
printf("Bir sayi giriniz: ");
scanf("%d", &sayi);
sonuc = ara(matrix, 0, n-1, sayi);
if ( sonuc == 1 )
printf("Found!\n");
else
printf("Not Found!\n");
}
what can be the big-O notation of this code? my guess is N*(2^(logN))
I have assigned my hw already! this is just my pre-curiosity!