Answer to Question #258861 in Java | JSP | JSF for masedi moncho

Question #258861

Consider two linked lists list1 with Integer values [1,2,3] and list2 with Integer values [4,5,6,7,8,9]



Suppose the merge method is called on list1 with list2 as parameter.



How many time will the following loop while((ptrThis != null) && (ptrParam != null)) iterate? Blank 1. Fill in the blank, read surrounding text.



After 3 iterations what will the value of ptrThis be? Blank 2. Fill in the blank, read surrounding text.


What will the value of ptrParam be? Blank 3. Fill in the blank, read surrounding text.



Do the pointer in both lists reach null at the same time? Yes/No Blank 4. Fill in the blank, read surrounding text.



1
Expert's answer
2021-10-30T10:37:05-0400
void merge(Node *first, Node **second)  
{  
    Node *firstRef = first;  
  
    // finding the lat node of first linked list  
    while (firstRef->next != NULL)  
    {  
         firstRef = firstRef->next;
    }  
   
    firstRef->next = *second;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS