Please complete the code below. I am given two sorted linked lists as it is show
ID: 3565974 • Letter: P
Question
Please complete the code below. I am given two sorted linked lists as it is shown in the parameter. Using node manipulation I have to merge sort the two lists.
void mergesort(list1 list2){
// TODO: your code goes here
// + this function merges the current list with the list pointed to by
// theOther.head
// + we assume that both lists are already sorted
// + by manipulating pointers, eventually head points to a sorted (merged)
// list, and you have to set theOther.head = NULL and theOther.numNodes = 0
// after all is done.
// + update numNodes accordingly too
}
Explanation / Answer
int main()
{
int no;
cin>>no;
int arr=new int[no];
for(int i=1;i<=no;i++)
{
cout<<arr[i]=i;
}
for(int k=1;k<=no;k++)
{
for(int z=1;z<=no;z++)
{
cout<<arr[z]<<",";
}
cut<<endl;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.