c - what is below function fun is doing include stdioh int arr10 012371217232490 int mainvoid int i fun710 return 0 int funint item int n int l0 rn1 whilelr int m lr2 ifitem arrm return m ifitem arrm l m1 else r m1 return 1 - skillgun

it is trying to insert a new element 7 in the given array of size 10 in the appropriate location so that resultant array will be still in sorted order.

it is trying to find given element 7 if it is available in the given array of 10 elements using linear search algorithm.

it is trying to find given element 7 if it is available in the given array of 10 elements using binary search algorithm.

it is trying to insert a new element 7 in the given array of size 10 in the last location.

Answer :(C)

it is trying to find given element 7 if it is available in the given array of 10 elements using binary search algorithm.

Description :

Assuming that already given array is sorted by using any of the
sorting algorithms.
function fun() is implementing binary search algorithm in this
given sorted array.
Binary search logic: since already elements are in sorted order
we will take two index one points to left, and other points to
right. we will calculate middle node by (left+right)/2.
what ever the number we want to find in the given array, we will
compare that element with arr[middle]. if it is found in the middle
then we will return that index. Else we will check if given item
is greater than middle node, in that case it means left hand side
sub array can be discarded as all the elements in that left side
are lesser than our item. And we will change left to point to
middle+1. and loop through next loop with this latest right array.
If the given item is less than middle node, then we will change
right to point to middle-1.
This way we will keep checking and discard half of the array elements
in each loop.