Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In C++ Please explain for better understanding of the overall process. Add the f

ID: 674050 • Letter: I

Question

In C++

Please explain for better understanding of the overall process.

Add the following operation to the class orderedLinkedList: void mergeLists(orderedLinkedList &list1;, orderedLinkedList &list2;); //This function creates a new list by merging the //elements of listi and list2. //Postcondition: first points to the merged list // list1 and list2 are empty Consider the following statements: orderedLinkedList newList; orderedLinkedList list1; orderedLinkedList list2; Suppose listi points to the list with the elements 2 6 7, and list2 points to the list with the elements 3 5 8. The statement: newList.mergeLists(listi, list2); creates a new linked list with the elements in the order 2 3 5 6 7 8, and the object newList points to this list. Also, after the preceding statement executes, list1 and list2 are empty. Write the definition of the function template mergeLists to implement the operation mergeLists.

Explanation / Answer

No No you dont have to code so much :) its simple Lets say there are two arrays List 1 and two so we first find their lengths...... and we make a new array of that length and we run a for loop of that length, and keep comparing the elements of LISt 1and two which one is greater goes to push and its corresponding index goes one down.... just see the code and use simple intuition... and its DONE!! MergeList( List 1 , List 2) { int l1 = ArraySize(List 1); int l2= ArraySize(List 2); int l3=l1 +l2 for(int i =0, j=0,k=0;iList2[k] { List3[i]=List2[k]; K=K++; } else List3[i]=List1[j]; j=j++; } if(j