Book Image

Hands-On Data Structures and Algorithms with Kotlin

By : Chandra Sekhar Nayak, Rivu Chakraborty
Book Image

Hands-On Data Structures and Algorithms with Kotlin

By: Chandra Sekhar Nayak, Rivu Chakraborty

Overview of this book

Data structures and algorithms are more than just theoretical concepts. They help you become familiar with computational methods for solving problems and writing logical code. Equipped with this knowledge, you can write efficient programs that run faster and use less memory. Hands-On Data Structures and Algorithms with Kotlin book starts with the basics of algorithms and data structures, helping you get to grips with the fundamentals and measure complexity. You'll then move on to exploring the basics of functional programming while getting used to thinking recursively. Packed with plenty of examples along the way, this book will help you grasp each concept easily. In addition to this, you'll get a clear understanding of how the data structures in Kotlin's collection framework work internally. By the end of this book, you will be able to apply the theory of data structures and algorithms to work out real-world problems.
Table of Contents (16 chapters)
Free Chapter
Section 1: Getting Started with Data Structures
Section 2: Efficient Grouping of Data with Various Data Structures
Section 3: Algorithms and Efficiency
Section 4: Modern and Advanced Data Structures


A LinkedList is a very basic data structure and is commonly used to solve many computer science problems. In the old world, various operating systems' file management software was based on LinkedList.

So far, we've learned how to create a LinkedList and expose APIs to do operations on it. This is the best time to summarize the complexity of it compared to other discussed data structures such as arrays or vectors. We should choose LinkedList over arrays or vectors when we need more insertion or deletion operations compared to fetch (index) operation. If we need more fetch (index) operations, we should choose arrays or vectors over a LinkedList. This conclusion isn't final though. We should still consider space complexity. If space is more of a concern to us than time, then arrays or vectors always beat a LinkedList.

Now a query may arise, that, if we have...