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 linkedlist from the smallest integer data value to the largest integer ie 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 linkedlist. The method then return a value head which is a reference to the sorted list. The method signature should use the following specification:
IntNode listSortIntNode head
For simplicity, your method will use the selection sort algorithm to sort the linkedlist.
NOTE:
Implement the linkedlist application as demonstrated in the lecture video. Therefore, you should submit a complete, standardalone, runnable program.
Your method should be implemented such that it move an entire node from the unsorted linkedlist to the sorted linkedlist. Therefore, the unsorted list should reduce in size as the sorted list increases in size. This method should NOT create new nodes.
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
