Announcing Data Structures & Algorithms in Swift, Fourth Edition!

The most comprehensive guide to data structures and algorithms you’ve ever seen! Build efficient iOS apps. Get your dream iOS job by acing technical interviews. By B. Patil.

Save for later

Creating efficient and scalable iOS apps is hard. 😩

Acing job interviews where they ask you about a data structure or an algorithm is challenging. 🧐

Don’t even get us started on how difficult it is to find a one-stop a two-in-one guide and reference for data structures and algorithms in Swift. ☹️

How would you like a book that solves all 3 of these problems? 🤩

Data Structures & Algorithms in Swift Can Help! ✨

Data Structures & Algorithms in Swift teaches you:

  • Why you should learn about data structures and algorithms.
  • How to implement the most popular and useful data structures.
  • When and why you should use one particular data structure or algorithm over another.
  • How to leverage the Swift Standard Library to implement data structures and algorithms.
  • How to compose data structures and algorithms together.

Who Is This Book For?

This book is for iOS developers who are acquainted with Swift and want to:

  • Immerse themselves in the exciting world of data structures and algorithms.
  • Build up their fundamentals for work and job interviews.
  • Learn tools and techniques to build highly performant code.
  • Craft solutions for big data that are scalable and efficient.

What’s Inside the Book?

This revised edition of Data Structures & Algorithms in Swift starts with the basics of Swift standard library, and then goes into deep into various data structures and algorithms.

Section I: Introduction

This is a short section, but you’ll learn:

  • Why you should learn data structures and algorithms.
  • What complexity of an algorithm means in practical terms.
  • Which data structures that are baked into the Swift Standard Library.

Section II: Elementary Data Structures

This section looks at a few important data structures that are not found in the Swift standard library but form the basis of more advanced algorithms covered in future sections. With practical challenges and exercises, you’ll learn about:

  • Stacks
  • Linked Lists
  • Queues

Section III: Trees

Trees are a great way to organize information. So, in this section, you’ll learn about them in good detail. Here’s everything covered in this section:

  • Trees
  • Binary Trees
  • Binary Search Trees
  • AVL Trees
  • Tries
  • Binary Search
  • Heaps
  • Priority Queues

Section IV: Sorting Algorithms

Sorting has been studied since the days of vacuum tubes and perhaps even before that. Although you may never need to write your own sorting algorithm using the highly optimized standard library, studying sorting has many benefits. Here’s a list of all the sorting algorithms covered in this section, with challenges:

  • O(n²) Sorting Algorithms
  • Merge Sort
  • Radix Sort
  • Heapsort
  • Quicksort

Section V: Graphs

Graphs are an instrumental data structure that can model a wide range of things: webpages on the internet, the migration patterns of birds, protons in the nucleus of an atom. Here’s all the sorting algorithms covered in this section, with challenges:

  • Graphs
  • Breadth-First Search
  • Depth-First Search
  • Dijkstra’s Algorithm
  • Prim’s Algorithm

What Do You Need?

To follow along with this book, you’ll need the following:

  • A Mac running the latest macOS: This is so you can install the latest version of the required development tool: Xcode.
  • Xcode 13 or later: Xcode is the main development tool for writing code in Swift. You need Xcode 13 at a minimum, since that version includes Swift 5.5. You can download the latest version of Xcode for free from the Mac App Store, here.

How to Get Your Own Copy

There are two ways you can get this book:

  • Buy it individually: If you want to build up a custom library without a subscription, you can choose to buy the book individually. It’s available now for just $59.99 in our online store.
  • Get it as part of our Pro subscription: Enjoy access to our videos and mobile development books in our Ultimate Pro subscription, including Data Structures & Algorithms in Swift! Right now, you can get a full year’s subscription and save 20% off the cost of a regular monthly subscription. It’s simply the best investment for your development career.

We hope you enjoy this book! Feel free to reach out to us if you have any questions.

Say Hi to our Team! 👋

Meet the awesome folks who contributed to this book…

Kelvin Lau [Author]: Kelvin Lau is an author of this book. Kelvin is a physicist turned Swift iOS Developer. While he’s currently entrenched with iOS development, he often reminisces of his aspirations to be part of the efforts in space exploration. Outside of programming work, he’s an aspiring entrepreneur and musician. You can find him on Twitter: @kelvinlauKL.

Vincent Ngo [Author]: Vincent Ngo is an author of this book. A software developer by day at a growing startup, and an iOS/Flutter enthusiast by night, he believes that sharing knowledge is the best way to learn and grow as a techie. Vincent starts every morning with a Cà phê sữa đá (Vietnamese coffee) to fuel his day. He enjoys playing golf, meditating, and watching animated movies. You can find him on Twitter: @vincentngo2.

Steven Van Impe [Tech Editor]: Steven Van Impe is the technical editor of this book. Steven is a computer science author and lecturer at the University College of Ghent, Belgium. You can find Steven on Twitter as @pwsacademy.

Ray Fix [Final Pass Editor]: Ray Fix is the final pass editor of this book. During the day, Ray works on next-generation microscopes made for iPad at Discover Echo Inc. in San Diego, California. He enjoys learning new things and is excited about math, data, visualization, machine learning and computer vision. Swift is his problem-solving language of choice and he has been using it and teaching others about it since its 2014 public release. Twitter: @rayfix.

Matthijs Hollemans [Contributor]: Matthijs Hollemans, the original creator of the Swift Algorithm Club. Matthijs contributed many of the implementations and corresponding explanations for the various data structures and algorithms in the Swift Algorithm Club that were used in this book, in particular: Graph, Heap, AVL Tree, BST, Breadth First Search, Depth First Search, Linked List, Stack & Queue, Tree, Selection Sort, Bubble Sort, Insertion Sort, Quick Sort, Merge Sort, and Heap Sort. Matthijs spends much of his time now in machine learning. Learn more at

B. Patil


B. Patil


Over 300 content creators. Join our team.