March 27th, 2013, 08:09 PM
Doubly Linked Lists
So on my homework, I'm given an initial Doubly linked list with 3 objects: in the first object is 12, the second object is 26, and the third is 46.
First is pointing to 12 & Last is pointing to 46.
Given the certain operations
I have to draw the new list.
deleteLast(), deleteLast(), insertFirst(26), deleteFirst(), insertLast(72), insertLast(65)
What I'm having trouble understanding is how the "previous" part of this linked list works (or if it plays any role in the operations given to me). I'm new to this and so I need some explanation on Doubly Linked Lists. So could anyone please explain it to me? I'm still new to Java.
March 28th, 2013, 08:32 AM
A good way to see how linked lists work, is to use a paper and pencil to draw the nodes in the list and then connect the nodes with the next and previous links.
If the list is:
looking at 2, next is 3 and previous is 1