40 likes | 126 Views
Learn about the variations of linked lists including circular linked lists in CS 308. Explore problems with singly connected lists, such as accessing only following nodes, inability to delete a node with just a pointer, and traversal challenges. Discover the extension of linear linked lists to circular ones by making the last node point back to the first.
E N D
Variations of Linked Lists CS 308 – Data Structures
Problems with singly connected lists • Given a node, we can access only nodes that follow it but not nodes that precede it. • We cannot delete a node, given only one a pointer to that node (location) • To access the last element of the list, we must traverse the whole list • We cannot traverse the list in reverse
Circular Linked Lists • Extending a linear linked list to a circular linked list • Make the last node point back to the first node
Extending a linear linked list to a circular linked list (cont.) • To have access to both the first and last nodes of the list, make listData point to the last node