Question: Java public void () figure { Node current = head; while (current != null) { current.next = current.next.next; current = current.next } If we make

Java

public void () figure {

Node current = head;

while (current != null) {

current.next = current.next.next;

current = current.next }

If we make an singly linked list (firstlist) and add the numbers 1, 2, 3, 4, 5, 6 and 7 to firstlist so that list consists of those seven numbers in order, then what does firstlist look like after calling firstlist.figure()?

Now pretend we make an singly liked list (seclist) and put the numbers 1, 2, 3, 4, 5 and 6 to seclist so seclist has those six numbers in order). What happens when calling seclist.figure()?

Explain the differences.

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!