40 likes | 121 Views
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 )
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