Preface Preface to the Kotlin Edition
This book is a work-in-progress and is under active development. It is currently incomplete, though more sections are being added regularly.
This Kotlin translation was done with the initial goal of supporting the Data Structures course at Carleton College in Northfield, MN, but I hope that others find this content useful as well.
Iβm deeply grateful for the fantastic work done by all of the previous authors on the original Python version (Bradley N. Miller, David L. Ranum, Roman Yasinovskyy), and then on the Java version that followed it (J. David Eisenberg). In updating this book for Kotlin, I have mostly started with the Java version, as it is often a closer fit to Kotlin. Sometimes, however, the content from the Python version is more relevant, and so in some cases I have brought back some content from the Python version that was changed or removed for the Java version.
The primary goal of this book is to teach data structures, and so my goal in translating and presenting code is to present that data structures content as clearly as possible. My assumption is that students reading this book and taking this course are those who have previous experience coding in another popular language, such as Java, Python, or C/C++. The style that I use for code in the data structures exercises largely reflects that. I hope that students learn Kotlin well as a secondary learning goal, but in general I donβt emphasize highly Kotlin-specific idioms in the code samples that I provide. To the extent possible, I have attempted to make the Kotlin code I provide to be as close to executable pseudocode is as possible, while still being Kotlin.
Kotlin does place a heavy emphasis on null safety. This is both welcome and unavoidable when programming in Kotlin. The sample code provided in this book, especially in the sections that use linked lists, make prominent use of nullable types.
Kotlin offers a variety of programming styles. Most notably, it enables functional programming styles if desired for a variety of situations. Common Kotlin tutorials and books use these functional features much more frequently than one finds in content for other programming languages. These features, such as Kotlin scope functions (
let, with, etc), lambda expressions, and more, are often combined with null safety and other operators in order to create elegant brief code in a style not commonly seen in Python, Java, or C/C++. In this book, I have chosen to generally not emphasize programming in these styles. As the primary goal of this book is to teach data structures, my goal has been to leverage as much as possible the programming experience that I assume students already have, while also taking advantage of some of the brevity and consistency that Kotlin offers.
Dave Musicant, Professor of Computer Science, Carleton College

