I am working on a homework assignment to make a program that searches using binary and linear searches. It compiles but the logical errors mean it doesn't work at all. I'm not really sure where I've gone wrong so any help would be great. Thanks.

This was the result I got when I tested it:Code:#include <stdio.h> #define SIZE 15 void binarySearch(int numbers[], int value); void linearSearch(int numbers[], int value); int main() { int numbers[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, }; printf("Searching for -1 in numbers using linear search\n"); linearSearch(numbers, -1); printf("Searching for -1 in numbers using binary search\n"); binarySearch(numbers, -1); printf("\nSearching for 0 in numbers using linear search\n"); linearSearch(numbers, 0); printf("Searching for 0 in numbers using binary search\n"); binarySearch(numbers, 0); printf("\nSearching for 7 in numbers using linear search\n"); linearSearch(numbers, 7); printf("Searching for 7 in numbers using binary search\n"); binarySearch(numbers, 7); printf("\nSearching for 11 in numbers using linear search\n"); linearSearch(numbers, 11); printf("Searching for 11 in numbers using binary search\n"); binarySearch(numbers, 11); printf("\nSearching for 15 in numbers using linear search\n"); linearSearch(numbers, 15); printf("Searching for 15 in numbers using binary search\n"); binarySearch(numbers, 15); printf("\nSearching for 22 in numbers using linear search\n"); linearSearch(numbers, 22); printf("Searching for 22 in numbers using binary search\n"); binarySearch(numbers, 22); return 0; } void binarySearch(int numbers[], int value) { int step = 1, left = 0, right = SIZE-1, mid; while (left < right) { mid = (left + right) / 2; if (numbers[mid] == value) { printf("Number found after %d steps\n", step); return; } else if (numbers[mid] < value) { left = mid+1; step++; } else right = mid-1; step++; } printf("Number not found after %d steps\n", step); } void linearSearch(int numbers[], int value) { /* Use linear search to find value in numbers. Print the number of steps it takes to find or not find value */ int steps, i; for (i=0; i < SIZE; i++) { if (value == numbers[i]) { printf("Number found after %d steps\n"); return; } printf("Number not found after %d steps\n"); } }

Your test result

Searching for -1 in numbers using linear search

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Searching for -1 in numbers using binary search

Number not found after 4 steps

Searching for 0 in numbers using linear search

Number found after 0 steps

Searching for 0 in numbers using binary search

Number not found after 4 steps

Searching for 7 in numbers using linear search

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number found after 0 steps

Searching for 7 in numbers using binary search

Number found after 1 steps

Searching for 11 in numbers using linear search

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number found after 0 steps

Searching for 11 in numbers using binary search

Number found after 3 steps

Searching for 15 in numbers using linear search

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Searching for 15 in numbers using binary search

Number not found after 7 steps

Searching for 22 in numbers using linear search

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Number not found after 0 steps

Searching for 22 in numbers using binary search

Number not found after 7 steps

Expected result

Searching for -1 in numbers using linear search

Number not found after 16 steps

Searching for -1 in numbers using binary search

Number not found after 5 steps

Searching for 0 in numbers using linear search

Number found after 1 steps

Searching for 0 in numbers using binary search

Number found after 4 steps

Searching for 7 in numbers using linear search

Number found after 8 steps

Searching for 7 in numbers using binary search

Number found after 1 steps

Searching for 11 in numbers using linear search

Number found after 12 steps

Searching for 11 in numbers using binary search

Number found after 2 steps

Searching for 15 in numbers using linear search

Number found after 16 steps

Searching for 15 in numbers using binary search

Number found after 5 steps

Searching for 22 in numbers using linear search

Number not found after 16 steps

Searching for 22 in numbers using binary search

Number not found after 6 steps