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

I NEED YOUR CODE TO COMPILE AND PASS THE TWO DRIVERS BELOW!!! ALSO USE //COMMENT

ID: 3539373 • Letter: I

Question

I NEED YOUR CODE TO COMPILE AND PASS THE TWO DRIVERS BELOW!!! ALSO USE //COMMENTS TO EXPLAIN YOUR CODE!


Sorting Linked Lists.
For this homework, you will write two methods, each method will go into the

LLMethods2.java file. Be sure to include the following file in the same directory as LLMethods2:

The first method you will write will have the following header

This method will recursively insert a thing (value) into a linked list (list) in order. Be sure to consider the case where list is empty.

The psuedocode for this method is:

.

The second method has the following header:

This method will take a linked list (list) in which the values are in any order and return a list in which the elements are in sorted order.

The psuedocode for this method is:

. .

Explanation / Answer

This is the sorting part of the code. void sorting () { ListNode * temphead = head; ListNode * tempnode = NULL; int counter = 0; while (temphead) { temphead = temphead->next; counter++; } for (int i=0; iroll > temphead->next->roll) { tempnode = temphead; temphead = temphead->next; temphead->next = tempnode; } } } }