Question: Java, please! Problem: In this problem, you will rearrange the nodes in a linked - list from the smallest integer data value to the largest

Java, please! Problem:
In this problem, you will rearrange the nodes in a linked-list from the smallest integer data value to the largest integer (i.e., the head node should hold the smallest integer value in the list). Implement a method called listSort() that receives a value head that points to the first node of the unsorted linked-list. The method then return a value head which is a reference to the sorted list. The method signature should use the following specification:
IntNode listSort(IntNode head)
For simplicity, your method will use the selection sort algorithm to sort the linked-list.
NOTE:
1. Implement the linked-list application as demonstrated in the lecture video. Therefore, you should submit a complete, standard-alone, runnable program.
2. Your method should be implemented such that it move an entire node from the unsorted linked-list to the sorted linked-list. Therefore, the unsorted list should reduce in size as the sorted list increases in size. This method should NOT create new nodes.
3. At the end of the operations, the sorted list should have the same number of nodes as the unsorted list initially had.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!