Book Image

Learning JavaScript Data Structures and Algorithms

By : Loiane Avancini
Book Image

Learning JavaScript Data Structures and Algorithms

By: Loiane Avancini

Overview of this book

Table of Contents (18 chapters)

Circular linked lists


A circular linked list can have only one reference direction (as the linked list) or a double reference as the doubly linked list. The only difference between the circular linked list and a linked list is that the last element's next (tail.next) pointer does not make a reference to null, but to the first element (head), as we can see in the following diagram:

And a doubly circular linked list has tail.next pointing to the head element and head.prev pointing to the tail element:

Note

We don't have the scope to cover the CircularLinkedList algorithm in this book (the source code is very similar to LinkedList and DoublyLinkedList). However, you can access the code by downloading this book's source code.