Computer Science
In visual studio, convert the following binary search function to (.asm) Assembly Language Code:
int binary_search(int sorted_list[], int low, int high, int element)
{
int middle;
while (low <=>=>
{
middle = low + (high - low)/2;
if (element > sorted_list[middle])
low = middle + 1;
else if (element <>
high = middle - 1;
else
return middle;
}
return -1;
}
int main(void)
{
int arr[] = { 2, 3, 4, 10, 40 }; // sorted array
int n = sizeof(arr) / sizeof(arr[0]); // total number of elements
int x = 10; // item that we are searching for
int result = binarySearch(arr, 0, n - 1, x);
return 0;
}
Please include comments, and a screenshot of the compiler.
Thank you!