Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am working on binary search code on C what will StringCompare code be so I cou

ID: 3639994 • Letter: I

Question

I am working on binary search code on C

what will StringCompare code be so I could continue


int FindStringInSortArray(string key, string array[], int n)
{
return (BinarySearch(key, array, 0, n-1));
}

static int BinarySearch(string key, string array[], int low, int high)
{
int mid, cmp;
if (low > high)
return (-1);
mid = (low+high)/2;
cmp = StringCompare(key, array[mid])
if (cmp == 0)
return (mid);
if (cmp < 0)
{
BinarySearch(key, array, low, mid - 1);
}
else
{
BinarySearch(key, array, mid + 1, high);
}

}

Explanation / Answer

if 2 strings s1=s2 then it returns 0 if 2 strings s10
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote