Question: Figure 2 shows a Java implementation of mergesort whose input is a linked list. Answer the following questions. Figure 2 . An implementation of mergesort
Figure shows a Java implementation of mergesort whose input is a linked list.
Answer the following questions.
Figure An implementation of mergesort of which an input is a linked list.
The following codes sort the list A and print all the elements of A from its head to
tail. Note that A getHead and AgetTail return the head and tail nodes of
A respectively. However, when you print the sorted list using the following codes,
you can find out the function mergeSort does not work correctly.
Why does mergeSort work incorrectly? How can you fix mergeSort to make
the function work correctly? points
Let be the length of an input linked list. How many times is mergeSort
called to sort the list? The initial call of the function should be included. points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
