📘 Data Structures & Algorithms Learning Path
for iOS Developers (Senior-Level)
✅ Completed DSA Examples
1. Remove Duplicates from Sorted Array (In-place)
Input: [1, 1, 1, 2, 3, 3, 6, 6, 7]
Output: [1, 2, 3, 6, 7]
Time Complexity: O(n)
Space Complexity: O(1)
Approach: Two-pointer traversal, replacing values in-place.
2. Zigzag Level Order Traversal (Binary Tree)
Input: Tree with nodes 1, 2, 3, 4, 5, 6, 7, 8
Output: [1, 3, 2, 4, 5, 6, 8, 7]
Time Complexity: O(n)
Space Complexity: O(n)
Approach: BFS using queue with directional toggle on each level.
3. Sort Linked List with 0s, 1s, and 2s
Input: 0 → 1 → 0 → 2 → 1 → 0 → 2 → 1
Output: 0 → 0 → 0 → 1 → 1 → 1 → 2 → 2
Time Complexity: O(n)
Space Complexity: O(1)
Approach: Count frequency and rewrite node data.
🧠 Key Concepts Recap
🔹 Time Complexity
• Definition: Number of operations relative to input size n .
• Examples:
• O(1) → Constant
• O(n) → Linear
• O(n log n) → Merge sort
• O(n^2) → Nested loops
🔹 Space Complexity
• Definition: Amount of extra space used.
• Goal: Optimize for in-place when possible.
1
🚧 Upcoming Topics
🔸 Arrays & Strings
• Two pointer problems
• Sliding window
• Prefix sum
🔸 Linked Lists
• Reverse
• Detect cycle
• Merge two sorted lists
🔸 Trees & Graphs
• DFS / BFS
• Inorder/Pre/Post traversals
• Lowest Common Ancestor
🔸 Recursion & Backtracking
• Subsets
• Permutations
• N-Queens
🔸 Sorting & Searching
• Binary search
• Quick sort
• Merge sort
🔸 Dynamic Programming
• Memoization vs Tabulation
• Fibonacci, Climbing Stairs
• Knapsack variations
⚙️ Practice Resources
• LeetCode
• HackerRank
• [Swift DSA GitHub Repos]
• [DSA in Swift Book / PDFs]
Let me know if you’d like: - 📄 PDF export of this - ✏️ Cheat sheets per topic - 🧪 Swift version of each
problem - 🔄 Mock interview Q&A per concept