Question: ( 1 0 % ) Consider the function func as shown below, where the two lists list 1 and list 2 are both ordered in

(10%) Consider the function func as shown below, where the two lists list 1 and list 2 are both ordered in ascending order.
struct item
{
int value;
struct item *next;
};
int func (struct item *list1, struct item *list2)
{
struct item *ptr1,*ptr2;
int count =0;
ptr1= list 1 ;
ptr2= list2;
while ((ptrl != NULL) &&&(ptr2 NULL))
{
if (ptrl->value ptr2->value)
ptrl = ptrl next;
else if (ptrl->value > ptrz->value)
ptr 2= ptr 2 next
else
{
ptr 1= ptr 1 next ;
ptr2= ptr 2 next ;
}
count ++;
}
return count;
}
If m and n are the number of items in list 1 and list 2 respectively, what is the worstcase time complexity of func(list 1, list 2)?
 (10%) Consider the function func as shown below, where the two

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!