Courses‎ > ‎AP Computer Science 2‎ > ‎Konstantinovich‎ > ‎

2017-03-27

posted Mar 27, 2017, 10:50 AM by Samuel Konstantinovich   [ updated Mar 27, 2017, 2:41 PM ]

Goal:  My Linked List


Git Directory /09*

09MyLinkedList

Should Include:

-MyLinkedList.java

                -LNode (inner class)

Methods That MyLinkedList.java should have:

            variables: (start with these and add more as we need them)

            LNode start;

            int size;

            methods:

        Hint: Start by writing add() to the start of the list, and toString() to see if it is working. Test these methods before writing new ones later!

How to loop through the elements:

Make a temporary reference to the node when you iterate through them (you can call it current)    

    LNode current = start;

In the loop use this piece of code to reference to the next of the temporary LNode or current

    current = current.next; //private access is fine

Comments