Sorting Swift collections
A look at the various sorting APIs that the Swift standard library offers, and how we could augment those APIs in order to make more advanced sorting tasks easier to perform.
Articles, podcasts and news about Swift development, by John Sundell.
A look at the various sorting APIs that the Swift standard library offers, and how we could augment those APIs in order to make more advanced sorting tasks easier to perform.
Nick Lockwood returns to the show to go on a deep dive into data structures and algorithms, what some of the pros and cons of writing high-performance code in Swift are, and how all of that relates to parallelization and performance.
This week, let’s take a look at a few key characteristics of the most common Swift data structures, and also how we sometimes might need to venture outside the standard library to find the right data structure for our needs.
Measuring the time complexity of a piece of code is a common technique used to optimize algorithms and other kinds of functions, by estimating their cost in terms of execution time. Let’s take a look at how to use “big O notation” to describe, measure, and improve the time complexity of a few different functions.
One major benefit of Swift’s protocol-oriented design is that it enables us to write generic code that’s compatible with a wide range of types. Let’s take a look at how we can wrap the Sequence protocol in generic containers, that’ll let us encapsulate various algorithms behind easy-to-use APIs.
Almost every program on the planet has to deal with strings one way or another, since text is so fundamental to how we both communicate and represent various forms of data. This week, let’s take a look at various ways to parse and extract information from strings, and how different techniques and APIs will yield a different set of trade-offs.