Introduction To Algorithms In Swift

Lay the foundations of algorithms and data structures in Swift 5. Level up your Swift 5 coding skills.

Last updated 2022-01-10 | 4.7

- 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)

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

* Requirements

* You should be comfortable with concepts like variables
* methods
* and classes
* Basic knowledge of Xcode
* A desire to learn

Description

Get a step-by-step, example-filled guide to algorithms and data structures. Companion eBook included.

This course is perfect for both beginners interested in understanding how computers are able to process data and experts who want to review the basics.

The better you understand how algorithms and data structures work, the more successful you'll be as a programmer. After taking this course, you'll master the fundamentals of algorithms and data structures. You'll also understand the time complexity of different algorithms, and we'll dive into code optimization techniques and sorting algorithms.

I'll explain each concept using easy-to-understand examples. We'll focus on the practical application, using hands-on code examples you can use for reference and practice. 

"Introduction to Algorithms and Data Structures in Swift 5" is a straightforward guide to solving coding problems more efficiently. Although the demos are implemented in Swift, the lessons can be applied to any programming language.

Throughout the course, I'll walk you through several demo applications to demonstrate the power of algorithms and the importance of picking the right solution.

What qualifies me to teach you?
I have more than 25 years of software development expertise. I've worked for companies like Apple, Siemens, and SAP.
As a software architect, I have designed and built several enterprise systems and frameworks, including core components of Siemens Healthcare's syngo image processing system. I'm one of the senior software architects behind the SAP Cloud Platform SDK for iOS, a framework built by Apple and SAP. I currently hold twelve patents related to inventions in the field of mobile computing.

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.


SUCCESS STORIES - SEE WHAT OTHERS HAVE ACHIEVED

"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


MORE THAN AN ONLINE COURSE. WITH THIS CLASS, YOU ALSO RECEIVE:

  • Personalized support
    As a student of this course, you’ll get access to the course's private forum, where I answer questions and provide support if necessary.

  • The companion eBook

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

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


OUR 30-DAY MONEY-BACK GUARANTEE

If you aren't satisfied with your purchase, we'll refund you your money. 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!

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

Course content

11 sections • 68 lectures

Welcome Preview 02:40

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

Is This Course for You? Preview 01:05

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

Why Should You Learn Algorithms? Preview 01:14

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

Prerequisites Preview 01:02

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

Demo Projects and Other Useful Resources Preview 00:30

Link to the demo project and other useful resources.

Join the Official Student Group Preview 00:20

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

Big O - Overview Preview 02:35

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.

Constant Time - O(1) Preview 05:40

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

Linear Time - O(n) Preview 04:17

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.

Quadratic Time - O(n2) Preview 03:53

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.

Hints for O(n^k) Complexity Preview 01:32

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

Logarithmic Time - O(log n) Preview 01:56

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.

Summary Preview 01:30


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

Big-O Source Code (Swift playground projects) Preview 00:36

Xcode playground projects for the Big-O section.

Recursion - Overview Preview 00:40

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

What is Recursion? Preview 02:38

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.

How Does Recursion Work? Preview 04:45

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.

Recursion Pitfalls Preview 02:37

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.

How to Avoid Infinite Recursion? Preview 01:51

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

Recursion Quizzes

Recursion Quizzes

Recursion Source Code (Swift playground projects) Preview 00:36

Recursion demos.

The Power of Algorithms - Overview Preview 01:29

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

Calculate Sum(N) Preview 03:04

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.

Pair Matching Challenge Preview 04:17

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.

Find the Equilibrium Index Preview 03:51

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.

Summary Preview 01:49

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 - Source Code (Swift playground projects) Preview 00:36

The Power of Algorithms - Xcode playground projects.

Generics - Overview Preview 00:55

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

Why Generics? Preview 01:24

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.

Generic Types Preview 01:56

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

Generic Functions Preview 03:47

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.

Generics Quizzes

Let's test your knowledge about Swift Generics!

Generics Sample Code (Swift playground project) Preview 00:36

Xcode playground projects for the Generics section.

Swift Collection Types - Overview Preview 00:55

The Array Preview 02:08

Accessing the Array Preview 01:09

Modifying the Array Preview 02:43

The Set Preview 02:27

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!

Accessing and Modifying the Set Preview 01:48

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

Set Operations Preview 01:10

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

The Hashable Protocol Preview 04:40

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 Dictionary Preview 02:33

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.

Accessing and Modifying the Dictionary Preview 01:35

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

Swift Collection Types Quizzes

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

Built-in Swift Collection Types - Demos (Swift playground projects) Preview 00:36

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

Basic Sorting - Overview Preview 02:17

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.

Selection Sort Preview 05:33

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 Summary Preview 00:49

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

Insertion Sort Preview 07:58

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 - Summary Preview 01:03

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!

Bubble Sort Preview 05:05

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 - Summary Preview 01:01

A brief summary of the bubble sort algorithm.

Basic Sorting Quizzes

Test your knowledge on basic sorting algorithms.

Basic Sorting Demos (Swift playground project) Preview 00:36

Xcode playground projects for the Basic Sorting section.

Advanced Sorting - Overview Preview 00:53

A brief overview of what to expect in this section.

Merge Sort Preview 03:46

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

Merge Sort - Summary Preview 00:55

Merge sort in a nutshell.

Quicksort Preview 03:28

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

Quicksort - Summary Preview 00:57

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

Advanced Sorting Quizzes

Quizzes for the Advanced Sorting Algorithms section.

Advanced Sorting Source Code (Swift playground projects) Preview 00:36

Xcode playground projects for the Advanced Sorting section.

Swift 5.1 Property Wrappers Preview 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.

Implement an Array-Based Stack

The stack is a collection of objects that are added and removed according to the last-in, first-out (LIFO) principle. New elements are added to the top of the Stack. You may only access or remove the most recently inserted object.

Fizz Buzz

Implement the Fizz Buzz algorithm in Swift.

Final Thoughts Preview 02:32

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

Companion eBook Preview 00:17

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

Bonus Lecture: Learn More from Karoly + Useful Links Preview 01:36

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