questiona using an appropriate example explain


QUESTION

(a) Using an appropriate example, explain what is a recursive function?

(b) Explain in detail the C++ function given below.

void search2(int list[],int n,int element)

{
int l,u,m, flag = 0;
l = 0;
u = n-1;
while(l <= u)
{ m = (l+u)/2;
if( list[m] == element)
{
cout <<" The element whose value is "<<
element << " is present at index " << m << " or position : " << m +1 << "\n";
flag =1;
break; }
else
if(list[m] < element)
l = m+1;
else
u = m-1; }
if( flag == 0)
cout <<"The element whose value is " << element << " is not present in the list\n";
}

(c) What is a "Merge Sort"?

(d) Write a piece of code to implement a "Bubble Sort"

Request for Solution File

Ask an Expert for Answer!!
Database Management System: questiona using an appropriate example explain
Reference No:- TGS0359484

Expected delivery within 24 Hours