Ashley P.

asked • 05/07/20

LinkedList Java

Imagine we have to create a Linked list with 5,8 as elements and at first before adding them head should pointed to null. And since 8 is the last element, next of 8 also should point to a null.


How do construct this LinkedList with following code skeleton.


Public class LinkedList {


static private class ListNode { }


Private static ListNode head;


Public static void main (String[] args) {}


}

2 Answers By Expert Tutors

By:

Patrick B. answered • 05/07/20

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.