Introduction to Algorithms and Data Structures in Swift 5
4.1 (332 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
2,216 students enrolled

Introduction to Algorithms and Data Structures in Swift 5

Lay the foundations of algorithms and data structures in Swift 5. Level up your Swift 5 coding skills.
4.1 (332 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
2,216 students enrolled
Last updated 4/2020
Current price: $72.99 Original price: $104.99 Discount: 30% off
11 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 2 hours on-demand video
  • 11 articles
  • 2 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Assignments
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Learn how to write elegant and efficient code from a leading expert
  • Cut down on your development time
  • Get the companion eBook for FREE! (sells for $28.80 on Amazon)
  • Gain a working knowledge of algorithmic thinking
  • Learn how to improve the performance of existing code
  • Get ready for technical job interviews
Course content
Expand all 60 lectures 02:12:47
+ Overview
6 lectures 07:07

I’m Karoly Nyisztor and welcome to Introduction to Algorithms and Data Structures in Swift.

Preview 02:45

Let's check whether you've got all it takes to enjoy and benefit from this course.

Preview 01:06

Still undecided? Here's why you should learn about algorithms and data structures.

Why Should You Learn Algorithms?

Here's what you need if you want to follow along with me.


Please join our official group to get even more feedback and support!

Join the Official Student Group

Link to the demo project and other useful resources.

Demo Projects and Other Useful Resources
+ Big O Notation
8 lectures 21:59

In this section we are going to talk about computational complexity. The Big-O notation is a mathematical model used in computer science to describe the efficiency of algorithms as a function of their input size. 

The best way to understand the Big-O thoroughly is via code examples. Therefore, we are going to illustrate each concept using live Swift coding.

Big O - Overview

In this lecture, we are going to talk about the Constant Time complexity. We'll also implement Swift functions that execute in constant time.

Preview 05:40

This lecture is about the Linear Time complexity. As usual, we'll not only talk about the theory, but we are going to also illustrate O(n) via Swift code examples.

Linear Time - O(n)

The topic of this lecture is the Quadratic Time complexity. We are going to delve into the world of nested loops and we'll discuss why they should be avoided if possible.

Quadratic Time - O(n2)

Do your best to avoid polynomial - and worse - time complexity. This lecture explains what to do if you encounter O(n^k).

Hints for O(n^k) Complexity

Let's take a closer look at the logarithmic time complexity. Logarithmic time represents an extremely efficient algorithm, used by the binary search technique for example.

Logarithmic Time - O(log n)

Understanding the Big-O notation paves the road to working with algorithms. This lecture is a brief summary of what we've learned during this module.


Big O Quizzes

Big O Quizzes
3 questions

Xcode playground projects for the Big-O section.

Big-O Source Code (Swift playground projects)
+ Recursion
6 lectures 13:07

An overview of what we're going to cover in the Recursion section.

Recursion - Overview

I'm going to show how what recursion is. We're going to analyze some examples and we'll even implement a recursive data structure.

Preview 02:38

In this video, I'm going to walk you through a demo to show you how recursion works. We're going to also solve an interesting problem.

How Does Recursion Work?

Recursion is great, but it doesn’t come without pitfalls. The biggest problem is infinite recursion. I’m going to illustrate it using an Xcode playground project.

Recursion Pitfalls

There are two basic rules we need to follow to avoid infinite recursion. Let's take a closer look at them.

How to Avoid Infinite Recursion?

Recursion Quizzes

Recursion Quizzes
4 questions

Recursion demos.

Recursion Source Code (Swift playground projects)
+ The Power of Algorithms
6 lectures 15:06

In this section, we are going to take a closer look at the importance and the benefits of algorithms and algorithmic thinking.

The Power of Algorithms - Overview

In this lecture, we are going to implement a function which calculates the sum of the first N natural numbers. We’ll start with a naive implementation. 
Then, we are going to implement a more efficient way to solve this problem using a formula that is more than 2000 years old.

Calculate Sum(N)

Our task is to implement a function that, given an array and a target value, returns zero-based indices of any two distinct elements whose sum is equal to the target sum.

Pair Matching Challenge

In this lecture, we are going to build a function to find the equilibrium indices of an array. The equilibrium index of an array is an index such that the sum of elements at lower indices is equal to the sum of elements at higher indices.

Find the Equilibrium Index

In this section, we’ve seen some practical examples of solving problems using two different approaches. Let's recap the biggest take-aways.


The Power of Algorithms - Xcode playground projects.

The Power of Algorithms - Source Code (Swift playground projects)
+ Working with Generics
5 lectures 08:38

This is what we're going to talk about in this section.

Generics - Overview

In this video, we'll try to solve a problem using a naive approach. We'll see where this leads and why generics are the way to go.

Why Generics?

Generic structures provide an elegant solution to the problem presented in the previous lecture. Here's how.

Generic Types

Generic functions can work with any type. In this lecture, I'll show you how to avoid code repetition. We'll also talk about generic functions and type constraints.

Generic Functions

Let's test your knowledge about Swift Generics!

Generics Quizzes
3 questions

Xcode playground projects for the Generics section.

Generics Sample Code (Swift playground project)
+ The Built-In Swift Collection Types
11 lectures 21:44
Swift Collection Types - Overview
The Array
Accessing the Array
Modifying the Array

We’ve seen that the array stores elements in a given order. We can even have duplicates in an array.
What if we need a collection that guarantees the uniqueness of its elements? The Set is the answer!

The Set

Now that we know how to create a Set, let’s talk about accessing and modifying its contents.

Accessing and Modifying the Set

The Set exposes useful methods that let us perform fundamental set operations.

Set Operations

There will be cases when you need to adopt the Hashable protocol.
For example, if you want to create a Set with your custom type, or use it as a key in a Dictionary, you can't avoid conforming to Hashable.

The Hashable Protocol

The Dictionary, also known as hash-map, stores key-value pairs. In this lecture, we're going to talk about topics like dictionary creation, heterogeneous dictionaries, the AnyHashable protocol and much more.

The Dictionary

The Dictionary provides various methods to access and modify its contents. This video takes a closer look at these methods.

Accessing and Modifying the Dictionary

Test your knowledge about the Array, the Set and the Dictionary

Swift Collection Types Quizzes
9 questions

Xcode playground projects for the "Built-In Swift Collection Types" section.

Built-in Swift Collection Types - Demos (Swift playground projects)
+ Basic Sorting
8 lectures 24:22

In this section we are going to talk about basic sorting algorithms.
Understanding the inner workings and knowing how to implement the basic sorting algorithms gives you a strong foundation to building other, more sophisticated algorithms.

Basic Sorting - Overview

We'll start the study of basic sorting algorithms with the selection sort algorithm. We are going to implement it in Swift. We’ll also visualize how selection sort works and we’ll analyze the time complexity of this algorithm.
Finally,we are going back up the theory with performance tests.

Selection Sort

Let's quickly recap the pros and cons of the selection sort algorithm.

Selection Sort Summary

Insertion sort is a basic sorting algorithm, which works by analyzing each element and inserting it into its proper place, while larger elements move one position to the right. 

Insertion sort has quadratic time complexity. However, the performance of the insertion sort is largely affected by the initial order of the elements in the sequence.

Insertion Sort

In the previous lecture, we took a closer look at the insertion sort algorithm. Did you know that even Apple uses it in their sort() implementation? Check out why!

Insertion Sort - Summary

The topic of this lecture is Bubble Sort. This algorithm works by repeatedly evaluating adjacent items and swapping their position if they are in the wrong order. While it's easy to grasp and implement, you don't want to use it in production code. Let's see why!

Bubble Sort

A brief summary of the bubble sort algorithm.

Bubble Sort - Summary

Test your knowledge on basic sorting algorithms.

Basic Sorting Quizzes
4 questions

Xcode playground projects for the Basic Sorting section.

Basic Sorting Demos (Swift playground project)
+ Advanced Sorting
6 lectures 10:35

A brief overview of what to expect in this section.

Advanced Sorting - Overview

The merge sort is a fast divide-an-conquer algorithm. Check out this lecture to see what that means.

Merge Sort

Merge sort in a nutshell.

Merge Sort - Summary

In this lecture, we'll analyze the famous quicksort - the king of the compare-based sorting algorithms.


Let's recap what we've learned about the popular - and fast - quicksort algorithm.

Quicksort - Summary

Quizzes for the Advanced Sorting Algorithms section.

Advanced Sorting Quizzes
3 questions

Xcode playground projects for the Advanced Sorting section.

Advanced Sorting Source Code (Swift playground projects)
+ Useful Swift Language Features
1 lecture 05:48

Apple introduced property wrappers in Swift 5.1 along with other useful features. Property wrappers are an elegant alternative to redundant property setters and getters. In this article, I provide a quick overview of property wrappers using hands-on Swift code examples.

Swift 5.1 Property Wrappers
+ Where Do You Go From Here?
3 lectures 04:18

Let me give you some useful online resources which will help you in sharpening your coding and problem solving skills.

Final Thoughts

Here's the companion eBook as a special gift to you (124 pages print length, sells for $28.80 on Amazon).

FREE Bonus eBook! (worth $28.80)

I share some links that will get you discounts on my other courses.

BONUS: Huge Discounts on My other Courses & Useful Links
  • You should be comfortable with concepts like variables, methods, and classes
  • Basic knowledge of Xcode
  • A desire to learn

** The very first Swift algorithms and data structures course on Udemy (Updated February 2020) **
Extra Bonus: Free e-book version included
(sells for $28.80 on Amazon)!

Take a closer look at algorithms and data structures and learn how to work with them to more efficiently approach software development with Swift.
"Introduction to Algorithms and Data Structures in Swift 5" is a straightforward guide to solving coding problems more efficiently. 

In this comprehensive course, author Károly Nyisztor helps to familiarize yourself with algorithmic thinking and code optimization techniques. He explains each concept using easy-to-understand examples. He focuses on the practical application, using hands-on Swift code examples you can use for reference and practice. 

Although the demos are implemented in Swift, the lessons can be applied to any programming language.

Throughout the course, Károly walks you through several demo applications to demonstrate the power of algorithms and the importance of picking the right solution.

Topics include:

  • Algorithmic thinking

  • The Big O notation

  • Constant, linear, polynomial and logarithmic time complexity

  • Understanding recursion and avoiding pitfalls

  • Case studies for finding faster solutions

  • Generics

  • Built-in Swift collection types

  • When to use a Set, an Array or a Dictionary?

  • Implementing selection sort, insertion sort, and bubble sort

  • Advanced sorting: quicksort and merge sort

The study of algorithms and data structures is fundamental to any programmer who plans to develop software systems that are scalable and performant. 
"Introduction to Algorithms and Data Structures in Swift 5" is the perfect course for you if you're interested in bringing your Swift coding skills to the next level.


"This course gives me a much deeper understanding of how to write efficient and effective Swift code. It addresses things not covered in the various other crash courses on iOS development, things not apparent at first. I'd published several simple apps and games already but discovered I needed this information when I started working on a much more complex app and needed to understand how to improve my app's performance, so I searched for information on that and discovered this very helpful course." - Minni K. Ang

"LOVE this instructor! His explanations are always clear and accurate, and his pacing is spot-on. Fantastic!" - Glenn

"Speed is very good for the content being taught. The size of the videos is perfect for the depth of the topic being discussed." - Nick Perkins

"Excellent clear presentation and covering the topic very well - recommended course!" - Graham Wright

"Very well made and in-depth explanations. Easy to follow and a lot of visual references making it very easy to understand! Great course overall and highly recommended." - Peter West


  • Expert instructions
    Karoly's been working as a software architect for more than two decades. He designed and developed professional systems, including core components of Siemens Healthcare's syngo image processing system.
    Karoly was one of the senior software architects behind the SAP Cloud Platform SDK for iOS, a framework built by Apple and SAP.

  • Premium support
    As a student of this course, you’ll get personalized attention and support.

  • The companion eBook for FREE!
    The paperback version sells for $28.80 on Amazon

  • Downloadable resources
    You get downloadable projects and other materials you can use to follow along and practice.

  • Continuous updates
    We keep enhancing this course to provide fresh and up-to-date content.


If you aren't satisfied with your purchase, we'll refund you your money - no questions asked! We want to make sure you're completely satisfied with the course. That's why we're happy to offer you this money-back guarantee.

Go ahead and click the enroll button. See you in the first lesson!


Károly Nyisztor is a veteran mobile developer and instructor.

He has built several successful iOS apps and games—most of which were featured by Apple—and is the founder at LEAKKA, a software development, and tech consulting company. He's worked with companies such as Apple, Siemens, SAP, and Zen Studios.

Currently, he spends most of his days as a professional software engineer and IT architect. In addition, he teaches object-oriented software design, iOS, Swift, Objective-C, and UML. As an instructor, his aim is to share his 20+ years of software development expertise and change the lives of students throughout the world. He's passionate about helping people reveal hidden talents, and guide them into the world of startups and programming.

You can find his courses and books on all major platforms including Amazon, Lynda, LinkedIn Learning, Pluralsight, Udemy, and iTunes.

Who this course is for:
  • Anyone who wants to implement better, more performant software applications
  • Developers interested in writing clean, modern Swift code
  • Anyone who's brand new to algorithms/data structures or needs a refresher