We may earn an affiliate commission when you visit our partners.
Course image
Udemy logo

Algorithms and Data Structures in Swift 5

Karoly Nyisztor • Professional Software Architect

Are you ready to elevate your Swift programming skills? Unlock the power of algorithms and data structures to solve coding problems more efficiently with our step-by-step, example-filled course. Companion eBook included.

Read more

Are you ready to elevate your Swift programming skills? Unlock the power of algorithms and data structures to solve coding problems more efficiently with our step-by-step, example-filled course. Companion eBook included.

This course is perfect for beginners who want to understand how computers process data, as well as experts looking to brush up on the basics.

Hi, I'm Karoly Nyisztor, a software engineer with over 25 years of experience, and I've worked with companies like Apple, Siemens, and SAP. I've designed and built several enterprise systems and frameworks, and I hold twelve patents in the field of mobile computing. I'm excited to share my knowledge with you in my course, "Algorithms and Data Structures in Swift 5."

In this comprehensive course, we'll cover algorithmic thinking, the Big-O notation, time complexity, recursion, generics, built-in Swift collection types, and data structures. We'll also explore various sorting algorithms and dive into code optimization techniques. I'll explain each concept using easy-to-understand examples and focus on the practical application with hands-on code examples you can reference and practice.

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?

  • Common data structures and their practical applications

  • Implementing selection sort, insertion sort, and bubble sort

  • Advanced sorting: quicksort and merge sort

With personalized support, a companion eBook, downloadable resources, and continuous updates, this course is more than just an online class.

Testimonials:

"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." - 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

With our 30-day money-back guarantee, there's no risk in giving it a try. So, go ahead and click the enroll button to start your journey toward mastering algorithms and data structures in Swift.

See you in the first lesson.

Enroll now

What's inside

Learning objectives

  • 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

Syllabus

This section provides an overview of this course.

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

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

Read more

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

Link to the demo project and other useful resources.

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

In this section we are going to talk about computational complexity. We are going to illustrate each concept using live Swift coding.

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.

I'll give you a quick overview of the common Big O time complexities: constant time, linear time, quadratic time, and logarithmic time. We'll discuss each of them in greater detail in the upcoming videos.

In this video, we'll delve into Constant Time complexity. I'll show you an example of an O(1) function and we'll discuss why constant time is the ideal Big O complexity.

In this lesson, we'll implement a high-precision QuartzCore-based benchmarking tool to measure execution times accurately. We’ll use this utility class to perform measurements in the upcoming demos.

In this lecture, we'll implement a couple of demo projects to illustrate the constant time complexity.

In this lecture, I'll demonstrate O(n)--linear time--complexity via Swift code examples.

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.

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

Let's take a closer look at the logarithmic time complexity. Logarithmic time denotes an extremely efficient algorithm, such as the binary search technique.


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

Xcode playground projects for the Big-O section.

We encounter recursion frequently while studying algorithms and data structures.

 Thus, it is important to understand what recursion is.

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

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.

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

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

Recursion Quizzes

Recursion demos.

Recursive Rescue: Patch the Exit Pitfall!
Dive Into The Spiral Of Fibonacci
In this section we are going to emphasize the importance and the benefits of algorithms and algorithmic thinking.

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

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.

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.

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.

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.

Incremental Sequence Generator
Learn about data structures, generics, and built-in Swift collection types

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

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 structures provide an elegant solution to the problem presented in the previous lecture. Here's how.

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.

Let's test your knowledge about Swift Generics!

Xcode playground projects for the Generics section.

In this section, we’re going to take a closer look at the built-in Swift collection types. Swift provides three primary collections. We’ll talk about:

- the Array, the Set and the Dictionary.
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!

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

The Set exposes useful methods that let us perform fundamental 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 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 provides various methods to access and modify its contents. This video takes a closer look at these methods.

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

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

In this module, you'll learn about the fundamental building blocks of computer programming. We'll explore the most common data structures, such as bags, stacks, and queues, and more.

In this module, we'll focus mainly on data structures that are not part of the standard Swift library, such as queues, stacks, and linked lists.

The tuple is a lightweight data structure that can hold values of different types. Let's have a closer look and see how to create, access, and modify tuples.

A practical example of weighing the pros and cons of using different data structures.

The queue is a linear data structure that processes elements in the order they were added. We'll discuss how queues work, and we'll implement a generic queue from scratch. I'll also show you a practical example of using queues.

Follow along as I'll implement a generic queue in Swift.

Let's analyze a practical application that relies heavily on the queue data structure.

In this lecture, we'll discuss the deque--short for "double-ended queue"--a linear data structure that allows insertion and deletion at both ends.

We'll implement a solution to finding the maximum element within a sliding window of size k. Let's start by explaining the algorithm and a first attempt to solve the problem.

In this video, we'll discuss the benefits of a deque-based approach to solving the sliding window maximum algorithm.

A stack is a linear data structure that stores elements in a Last-In-First-Out (LIFO) order. This video discusses what you can do with a stack, what are its strengths and when should you use a different data structure.

In this video, I'll show you an efficient approach to implementing a stack using an array as its underlying storage.

Follow along as I demonstrate how stacks can be used to determine the validity of arithmetical expressions. This particular problem would serve as an excellent choice for a job interview question.

Xcode playground projects for the "Basic Data Structures and Their Practical Applications" section.

Basic Sorting

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.

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.


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

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.

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!

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!

A brief summary of the bubble sort algorithm.

Test your knowledge on basic sorting algorithms.

Xcode playground projects for the Basic Sorting section.

Advanced Sorting

A brief overview of what to expect in this section.

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

Merge sort in a nutshell.

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.

Quizzes for the Advanced Sorting Algorithms section.

Xcode playground projects for the Advanced Sorting section.

Test Your Skills
Fizz Buzz
So, what’s next? I’ll give you some useful online resources which will help you in sharpening your coding and problem solving skills.

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

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

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

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Provides practical coding applications for students who are learning Swift, or experienced engineers seeking a refresher
Taught by Karoly Nyisztor, a software engineer with over 25 years of experience
Gives learners a working knowledge of algorithmic thinking
Explores advanced sorting algorithms, like quicksort and merge sort
Examines constant, linear, polynomial, and logarithmic time complexity

Save this course

Save Algorithms and Data Structures in Swift 5 to your list so you can find it easily later:
Save

Reviews summary

Adequate learning resource

According to students, this course offers good content and engaging assignments. However, many hope to see a more thorough breakdown of the algorithms covered. Students should be advised that this course is not regarded as difficult by learners.
Students do not find this course to be particularly difficult.
"Seems like every part of explanation of a function is way too fast to understand the logic of the code"
Students are generally satisfied with the content covered.
"Good course..."
"engaging assignments..."
Students would like to see more detail devoted to the algorithms covered.
"I would like to see a more in depth break down of the algorithms functions like quick sort and merge sort."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Algorithms and Data Structures in Swift 5 with these activities:
Review previous notes and assignments
Refreshes your memory of the key concepts and prepares you for new material.
Show steps
  • Go through your notes and assignments from previous courses related to algorithms and data structures.
  • Focus on the main concepts and try to recall the details.
  • Identify any areas where you need further review.
Read 'Introduction to Algorithms' by Cormen, Leiserson, and Rivest
Provides a foundational understanding of algorithmic thinking and complexity analysis.
Show steps
  • Read the first few chapters to get a grasp of the basics.
  • Work through the practice problems at the end of each chapter.
  • Implement some of the algorithms in your preferred programming language.
Review Data Structures Concepts
Warms up your knowledge of basic data structures and their applications.
Browse courses on Data Structures
Show steps
  • Review the basics of arrays, linked lists, stacks, and queues.
  • Implement a few simple data structures in your preferred programming language.
  • Analyze the performance of your implementations.
Five other activities
Expand to see all activities and additional details
Show all eight activities
Join a study group or online forum for the course
Provides opportunities to ask questions, share knowledge, and collaborate with others.
Show steps
  • Find a study group or online forum related to the course.
  • Introduce yourself and ask questions about the material.
  • Participate in discussions and help others with their questions.
Follow tutorials on dynamic programming
Enhances your problem-solving skills and ability to design efficient algorithms.
Browse courses on Dynamic programming
Show steps
  • Find a reputable online course or tutorial on dynamic programming.
  • Follow the lessons and complete the exercises.
  • Apply the techniques you learn to solve real-world problems.
Solve LeetCode problems
Develops your problem-solving skills and prepares you for technical interviews.
Show steps
  • Start with easier problems and gradually work your way up to harder ones.
  • Read the discussion forums to learn from other people's solutions.
  • Time yourself to improve your speed and efficiency.
Write a blog post about a challenging algorithm you implemented
Solidifies your understanding of the algorithm and helps you articulate your thought process.
Show steps
  • Choose an algorithm that you found particularly challenging to implement.
  • Write a detailed explanation of the algorithm, including its time and space complexity.
  • Describe the challenges you faced during implementation and how you overcame them.
  • Publish your blog post and share it with others.
Contribute to an open-source project related to algorithms or data structures
Provides practical experience and exposes you to real-world applications of algorithms and data structures.
Browse courses on Open Source
Show steps
  • Find an open-source project that interests you and is related to the course material.
  • Read the project documentation and familiarize yourself with the codebase.
  • Identify an area where you can make a contribution.
  • Submit a pull request with your proposed changes.

Career center

Learners who complete Algorithms and Data Structures in Swift 5 will develop knowledge and skills that may be useful to these careers:
Software Engineer
A Software Engineer designs, builds, and maintains software. They get to work on problems whose solutions make a real difference in the lives of others. This course teaches practical application with hands-on code examples you can reference and practice. You'll be well prepared to solve problems faced by Software Engineers on the job.
Data Scientist
A Data Scientist analyzes data to extract meaningful insights that can be used to solve problems. Data Scientists often come from a background in Computer Science, but it is not required. This course teaches algorithmic thinking and time complexity, both of which are essential for a Data Scientist to be successful.
Machine Learning Engineer
A Machine Learning Engineer builds and maintains machine learning models to solve problems. Machine Learning Engineers typically have a background in Computer Science or a related field. This course covers topics such as algorithms and data structures, which are foundational for Machine Learning Engineers.
Quantitative Analyst
A Quantitative Analyst uses mathematical and statistical methods to analyze data and make predictions. Quantitative Analysts typically have a background in Mathematics, Statistics, or a related field. This course covers topics such as algorithms and data structures, which can be helpful for Quantitative Analysts.
Software Architect
A Software Architect designs and oversees the construction of software systems. Software Architects typically have a background in Computer Science or a related field. This course covers topics such as algorithms and data structures, which are essential for Software Architects.
Technical Product Manager
A Technical Product Manager bridges the gap between the business and technology teams. Technical Product Managers typically have a background in Computer Science or a related field. This course covers topics such as algorithms and data structures, which can be helpful for Technical Product Managers.
Data Analyst
A Data Analyst collects, analyzes, and interprets data to provide insights to businesses. Data Analysts typically have a background in Mathematics, Statistics, or a related field. This course covers topics such as algorithms and data structures, which can be helpful for Data Analysts.
Database Administrator
A Database Administrator manages and maintains databases. Database Administrators typically have a background in Computer Science or a related field. This course covers topics such as algorithms and data structures, which are helpful for Database Administrators.
Systems Analyst
A Systems Analyst analyzes and designs systems to meet business needs. Systems Analysts typically have a background in Computer Science or a related field. This course covers topics such as algorithms and data structures, which can be helpful for Systems Analysts.
Computer Programmer
A Computer Programmer writes and maintains code for software applications. Computer Programmers typically have a background in Computer Science or a related field. This course covers topics such as algorithms and data structures, which are essential for Computer Programmers.
Web Developer
A Web Developer designs and develops websites. Web Developers typically have a background in Computer Science or a related field. This course covers topics such as algorithms and data structures, which can be helpful for Web Developers.
Computer Scientist
A Computer Scientist researches and develops new computing technologies. Computer Scientists typically have a background in Computer Science or a related field. This course covers topics such as algorithms and data structures, which are essential for Computer Scientists.
Information Systems Manager
An Information Systems Manager plans and manages the implementation of information systems. Information Systems Managers typically have a background in Computer Science or a related field. This course covers topics such as algorithms and data structures, which can be helpful for Information Systems Managers.
Computer Support Specialist
A Computer Support Specialist provides technical support to computer users. Computer Support Specialists typically have a background in Computer Science or a related field. This course covers topics such as algorithms and data structures, which can be helpful for Computer Support Specialists.
Teacher
A Teacher educates students in a variety of subjects. Teachers typically have a bachelor's degree in education or a related field. This course may be helpful for Teachers who want to teach computer science or related subjects.

Reading list

We've selected ten books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Algorithms and Data Structures in Swift 5.
This classic textbook provides a comprehensive introduction to algorithms, data structures, and their applications. It valuable resource for students and professionals who want to deepen their understanding of algorithmic thinking.
Comprehensive guide to algorithm design and analysis. It valuable resource for students and professionals who want to learn how to design and analyze efficient algorithms.
Classic textbook on algorithms and data structures. It valuable resource for students and professionals who want to deepen their understanding of the foundations of computer science.
Provides a clear and concise introduction to algorithms and data structures. It great resource for students who are new to the subject.
Provides a comprehensive introduction to data structures and algorithms in Java. It valuable resource for students and professionals who want to learn how to implement and use data structures in their code.
Provides a comprehensive introduction to data structures and algorithms in C++. It valuable resource for students and professionals who want to learn how to implement and use data structures in their C++ code.
Classic series of textbooks on computer programming. It valuable resource for students and professionals who want to learn about the foundations of computer science.
Provides a comprehensive introduction to discrete mathematics. It valuable resource for students and professionals who want to learn about the mathematical foundations of computer science.
Provides a comprehensive introduction to discrete mathematics. It valuable resource for students and professionals who want to learn about the mathematical foundations of computer science.
Provides a concise introduction to the mathematical foundations of computer science. It valuable resource for students who are new to the subject and want to learn about the mathematics that underlies computer science.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to Algorithms and Data Structures in Swift 5.
Data Structures & Algorithms in Swift
Most relevant
Data Structures and Algorithms In Java ( DSA )
Most relevant
Modern C++ Concurrency in Depth ( C++17/20)
Introduction to Data Structures and Algorithms in C++
Algorithms and Data Structures - Part 1
Introduction to Java Programming: Fundamental Data...
Programming Fundamentals in Swift
Data Structures: An Active Learning Approach
Easy to Advanced Data Structures
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser