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

JAVA on netbeans write a method that sorts a linked list this method is not help

ID: 3718394 • Letter: J

Question

JAVA on netbeans

write a method that sorts a linked list

this method is not helpfull. Please need the output

private class Node{
int data;
Node link;

public Node(){
data = Int.minimum_val;
link = null;
}

public Node(int a, Node x){
data = a;
link = x;
}
}
// End of Node class

public Node head;

public LinkedList11(){
head = null;
}

public void insertAscending(int data){

Node node = new Node();
node.data = data;

if (head == null)
head = node;
Node p = head;

while (p.link != null)
{
if (p.link.data > data)
{ node.link = p.link;
p.link = node;
break;
}
p= p.link;
}

}
}

Explanation / Answer

Please find my implementation.