-
With no questions, we launched into doubly linked lists, challenging the class to come up with an equivalent program as what we came up with for singly linked lists; namely, the following:
nodes now have a prev pointer in addition to a next pointer
you can now have an end node pointer in addition to a start node pointer
prompt the user for input (-1 to stop)
build a list with those user-input values (essentially appending)
display the list (forward)
display the list (backward)
prompt for node to insert after
prompt for value of new node
insert newly valued node after indicated node
display the list (forward)
display the list (backward)
As we finish up the singly linked list operations for insert and remove, don't be surprised to see similar projects for the doubly linked list.
Most importantly- make sure you do both. Just doing the doubly linked list operations is only half the story. I will want to see completed projects employing logic for singly as well as doubly linked lists.
I saw increasing instances where drawing pictures would have saved confusion. I am not going to bail you out in such situations. I will help, sure. But when I see a case where I thing your problem can be worked out by drawing a picture and working yourself through the logic, I will tell you.
It isn't helpful to help someone extensively through this process- we're learning an algorithm as much as a concept. If you can't become comfortable with drawing pictures and working through (and recognizing) the necessary steps of the operation, you'll quickly find yourself limited, or needing constant help.
Please aim to do the insert and remove operations on your own.