Group Group Group Group Group Group Group Group Group Group Shape Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group
Skip to Content
  • iii. Dedications
  • More
    • NewsletterNewsletter
    • ForumsForums
Sign In
Create a free account
  • Search
  • Notebook
  • Customise
Pro

Data Structures & Algorithms in Swift

Fourth Edition Swift 5.5, iOS 15, Xcode 13

Before You Begin

Section 0: 6 chapters
  • i. What You Need
  • ii. Book Source Code & Forums
  • iii. Dedications
  • iv. About the Team
  • v. Acknowledgments
  • vi. Foreword

Section I: Introduction

Section 1: 3 chapters
  • 1. Why Learn Data Structures & Algorithms?
    • 1.1 The goal of this book
  • 2. Complexity
    • 2.1 Time complexity
    • 2.2 Space complexity
    • 2.3 Other notations
    • 2.4 Playground line-based execution bug
    • 2.5 Key points
  • 3. Swift Standard Library
    • 3.1 Array
    • 3.2 Dictionary
    • 3.3 Set
    • 3.4 The Swift Collections package
    • 3.5 Key points

Section II: Elementary Data Structures

Section 2: 6 chapters
  • 4. Stacks
    • 4.1 Stack operations
    • 4.2 Implementation
    • 4.3 push and pop operations
    • 4.4 Key points
  • 5. Stack Challenges
    • 5.1 Solutions
  • 6. Linked Lists
    • 6.1 Node
    • 6.2 LinkedList
    • 6.3 Adding values to the list
    • 6.4 Removing values from the list
    • 6.5 Swift collection protocols
    • 6.6 Becoming a Swift collection
    • 6.7 Value semantics and copy-on-write
    • 6.8 Optimizing COW
    • 6.9 Key points
  • 7. Linked List Challenges
    • 7.1 Solutions
  • 8. Queues
    • 8.1 Common operations
    • 8.2 Example of a queue
    • 8.3 Array-based implementation
    • 8.4 Doubly linked list implementation
    • 8.5 Ring buffer implementation
    • 8.6 Double-stack implementation
    • 8.7 Key points
  • 9. Queue Challenges
    • 9.1 Solutions

Section III: Trees

Section 3: 16 chapters
  • 10. Trees
    • 10.1 Terminology
    • 10.2 Implementation
    • 10.3 Traversal algorithms
    • 10.4 Key points
  • 11. Tree Challenges
    • 11.1 Solutions
  • 12. Binary Trees
    • 12.1 Implementation
    • 12.2 Traversal algorithms
    • 12.3 Key points
  • 13. Binary Tree Challenges
    • 13.1 Solutions
  • 14. Binary Search Trees
    • 14.1 Case study: array vs. BST
    • 14.2 Implementation
    • 14.3 Key points
  • 15. Binary Search Tree Challenges
    • 15.1 Solutions
  • 16. AVL Trees
    • 16.1 Understanding balance
    • 16.2 Implementation
    • 16.3 Key points
    • 16.4 Where to go from here?
  • 17. AVL Tree Challenges
    • 17.1 Solutions
  • 18. Tries
    • 18.1 Example
    • 18.2 Implementation
    • 18.3 Key points
  • 19. Trie Challenges
    • 19.1 Solutions
  • 20. Binary Search
    • 20.1 Example
    • 20.2 Implementation
    • 20.3 Key points
  • 21. Binary Search Challenges
    • 21.1 Solutions
  • 22. Heaps
    • 22.1 What is a heap?
    • 22.2 The heap property
    • 22.3 Heap applications
    • 22.4 Common heap operations
    • 22.5 How do you represent a heap?
    • 22.6 Removing from a heap
    • 22.7 Inserting into a heap
    • 22.8 Removing from an arbitrary index
    • 22.9 Searching for an element in a heap
    • 22.10 Building a heap
    • 22.11 Testing
    • 22.12 Key points
  • 23. Heap Challenges
    • 23.1 Solutions
  • 24. Priority Queues
    • 24.1 Applications
    • 24.2 Common operations
    • 24.3 Implementation
    • 24.4 Testing
    • 24.5 Key points
  • 25. Priority Queue Challenges
    • 25.1 Solutions

Section IV: Sorting Algorithms

Section 4: 10 chapters
  • 26. O(n²) Sorting Algorithms
    • 26.1 Bubble sort
    • 26.2 Selection sort
    • 26.3 Insertion sort
    • 26.4 Generalization
    • 26.5 Key points
  • 27. O(n²) Sorting Challenges
    • 27.1 Solutions
  • 28. Merge Sort
    • 28.1 Example
    • 28.2 Implementation
    • 28.3 Performance
    • 28.4 Key points
  • 29. Merge Sort Challenges
    • 29.1 Solutions
  • 30. Radix Sort
    • 30.1 Example
    • 30.2 Implementation
    • 30.3 Key points
  • 31. Radix Sort Challenges
    • 31.1 Solution to Challenge 1
  • 32. Heapsort
    • 32.1 Getting started
    • 32.2 Example
    • 32.3 Implementation
    • 32.4 Performance
    • 32.5 Key points
  • 33. Heapsort Challenges
    • 33.1 Solutions
  • 34. Quicksort
    • 34.1 Example
    • 34.2 Partitioning strategies
    • 34.3 Effects of a bad pivot choice
    • 34.4 Key points
  • 35. Quicksort Challenges
    • 35.1 Solutions

Section V: Graphs

Section 5: 11 chapters
  • 36. Graphs
    • 36.1 Weighted graphs
    • 36.2 Common operations
    • 36.3 Defining a vertex
    • 36.4 Defining an edge
    • 36.5 Adjacency list
    • 36.6 Implementation
    • 36.7 Adjacency matrix
    • 36.8 Implementation
    • 36.9 Graph analysis
    • 36.10 Key points
  • 37. Graph Challenges
    • 37.1 Solutions
  • 38. Breadth-First Search
    • 38.1 Example
    • 38.2 Implementation
    • 38.3 Performance
    • 38.4 Key points
  • 39. Breadth-First Search Challenges
    • 39.1 Solutions
  • 40. Depth-First Search
    • 40.1 Example
    • 40.2 Implementation
    • 40.3 Performance
    • 40.4 Key points
  • 41. Depth-First Search Challenges
    • 41.1 Solutions
  • 42. Dijkstra’s Algorithm
    • 42.1 Example
    • 42.2 Implementation
    • 42.3 Trying out your code
    • 42.4 Performance
    • 42.5 Key points
  • 43. Dijkstra’s Algorithm Challenges
    • 43.1 Solutions
  • 44. Prim’s Algorithm
    • 44.1 Example
    • 44.2 Implementation
    • 44.3 Testing your code
    • 44.4 Performance
    • 44.5 Key points
  • 45. Prim’s Algorithm Challenges
    • 45.1 Solutions
  • 46. Conclusion
Home iOS & Swift Books Data Structures & Algorithms in Swift

iii
Dedications

“To my team, family, and friends.”

— Kelvin Lau

“To my friends and family who I know will never read this book.”

— Vincent Ngo

iv. About the Team ii. Book Source Code & Forums

Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum here.

© 2022 Razeware LLC