Skip to Main Content
Hands-On Data Structures and Algorithms with Kotlin
book

Hands-On Data Structures and Algorithms with Kotlin

by Chandra Sekhar Nayak, Rivu Chakraborty
February 2019
Intermediate to advanced content levelIntermediate to advanced
220 pages
5h 40m
English
Packt Publishing
Content preview from Hands-On Data Structures and Algorithms with Kotlin

Understanding the Doubly Linked List

In many operations operated on a Singly Linked List, we've observed that, to get a previous node of any particular node, we need to traverse from the head of the LinkedList. This is a performance hit. Of course, we can ignore it if the LinkedList is small but, for Linked Lists that are big in size, the time taken to get the previous node is larger. To avoid this performance problem, we can simply store the previous node reference of every node in the same way we store the next node reference. This is what we call a Doubly Linked List.

We can represent it in a graphical way as follows:

Like a Singly Linked ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn Data Structures and Algorithms with Golang

Learn Data Structures and Algorithms with Golang

Bhagvan Kommadi
Functional Programming in Kotlin

Functional Programming in Kotlin

Runar Bjarnason, Paul Chiusano, Marco Vermeulen

Publisher Resources

ISBN: 9781788994019Supplemental Content