Question: pls explain what these 2 methods do thank u. public void insert(int data) { Node new_node = new Node(data); new_node.next = null; if (head ==
pls explain what these 2 methods do thank u.
public void insert(int data) { Node new_node = new Node(data); new_node.next = null; if (head == null) { head = new_node; } else { Node last = head; while (last.next != null) last = last.next; last.next = new_node; } } public void make_partition(int x){ Node list2 = head; Node curr = head; while(curr!=null){ Node next = curr.next; if(curr.data
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
