Question: Take the code that you created for Week 6 Snippet # 2 and first make the minor modification necessary to create a circular linked list

Take the code that you created for Week 6 Snippet #2 and first make the minor modification necessary to create a circular linked list [Hint: Store a pointer to the first node in the next pointer of the last node.] Demonstrate that this is working by traversing the list until the first pointer is encountered 3 times.
Next, redefine the node structure to include a back pointer. This will enable your program to move from front to back and then from back to front. It is not circular because the ends are still NULL. Demonstrate this by traversing the list forward and then traverse the link backward. [Hint: Create two pointers in the head one to the front of the linked list and one to the rear of the linked list.]

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 Accounting Questions!