Classic Computer Science Problems in Swift
Essential techniques for practicing programmers
David Kopec
  • MEAP began June 2017
  • Publication in February 2018 (estimated)
  • ISBN 9781617294891
  • 275 pages (estimated)
  • printed in black & white

It can be exhausting chasing the next AMAZING new thing: NEW language, NEW framework, NEW platform, NEW device. Classic Computer Science Problems in Swift invites you to invest your energy in some foundational techniques that have been proven to stand the test of time. This engaging, imminently-practical book teaches you to recognize and solve the most common categories of problems you'll face as a programmer, including search, clustering, and even AI. Working through the easily digested examples in every chapter, you'll get hands-on practice that will serve you well in app development, optimization, and tool building. Along the way you'll learn intermediate and advanced features of the Swift programming language, a worthwhile skill in its own right.

"Fun read to sharpen your Swift programming skills. Great book to bring your Swift programming to another level."

~ Becky Huett

"I would say that every programming language needs an author to write a book like this."

~ Patrick Regan

Table of Contents detailed table of contents

Introduction

0.1 Why Swift?

0.2 What is a classic computer science problem?

0.3 What kinds of problems are in this book?

0.4 Who is this book for?

0.5 Swift Versioning and Tools

0.6 No Graphics, No UI Code

1 Small Problems

1.1 The Fibonacci Sequence

1.1.1 A First Recursive Attempt

1.1.2 Utilizing Base Cases

1.1.3 Memoization to the Rescue

1.1.4 Keep it Simple, Fibonacci

1.2 Trivial Compression

1.3 Unbreakable Encryption

1.3.1 Getting Our Data in Order

1.3.2 Encrypting and Decrypting

1.4 Calculating Pi

1.5 The Towers of Hanoi

1.5.1 Modeling the Towers

1.5.2 Solving The Towers of Hanoi

1.6 Real World Applications

1.7 Exercises

2 Search Problems

2.1.1 Storing DNA

2.1.4 A Generic Example

2.2 Maze Solving

2.2.1 Generating a Random Maze

2.2.2 Miscellaneous Maze Minutiae

2.3 Missionaries and Cannibals

2.3.1 Representing the Problem

2.3.2 Solving

2.4 Real World Applications

2.5 Exercises

3 Constraint Satisfaction Problems

3.1 Building a Constraint Satisfaction Problem Framework

3.2 The Australian Map Coloring Problem

3.3 The Eight Queens Problem

3.5 SEND+MORE=MONEY

3.6 Circuit Board Layout

3.7 Real World Applications

3.8 Exercises

4 Graph Problems

4.1 Building a Graph Framework

4.1.1 A Concrete Implementation of Edge

4.1.2 A Concrete Implementation of Graph

4.2 Finding the Shortest Path

4.2.1 Defining a Path

4.2.2 Revisiting Breadth-First Search (BFS)

4.3 Minimizing the Cost of Building the Network

4.3.1 Workings with Weights

4.3.2 Finding the Minimum Spanning Tree

4.4 Finding Shortest Paths in a Weighted Graph

4.4.1 Dijkstra’s Algorithm

4.5 Real World Applications

4.6 Exercises

5 Genetic Algorithms

5.1 Preliminaries

5.2 A Generic Genetic Algorithm

5.3 A Naive Test

5.4 SEND+MORE=MONEY Revisited

5.5 Challenges for Genetic Algorithms

5.6 Real World Applications

5.7 Exercises

6 K-Means Clustering

6.1 Preliminaries

6.2 The K-Means Clustering Algorithm

6.3 Clustering Governors by Age and Longitude

6.4 K-Means Clustering Problems and Extensions

6.5 Real World Applications

6.6 Exercises

7 Fairly Simple Neural Networks

7.1 Biological Basis?

7.2 Artificial Neural Networks

7.2.1 Neurons

7.2.2 Layers

7.2.3 Backpropagation

7.2.4 The Big Picture

7.3 Preliminaries

7.3.1 Help with Randomization

7.3.2 Fast Arithmetic

7.3.3 The Activation Function

7.4 Building the Network

7.4.1 Neurons

7.4.2 Layers

7.4.3 The Network

7.5 Classification Problems

7.5.1 Normalizing Data

7.5.2 The Classic Iris Data Set

7.5.3 Classifying Wine

7.6 Neural Network Problems and Extensions

7.7 Real World Applications

7.8 Exercises

8 Miscellaneous Problems

8.1 The Knapsack Problem

8.2 The Travelling Salesman Problem

8.2.1 The Naive Approach

8.2.2 Taking it to the Next Level

8.3 Phone Number Mnemonics

8.4 Tic-Tac-Toe

8.4.1 Managing State

8.4.2 Minimax

8.5 Real World Applications

8.6 Exercises

Appendixes

Appendix A: A Glossary

Appendix B: B More Resources

B.1 Swift

B.2 iOS Development

B.3 Mac Development

B.4 Algorithms and Data Structures

B.5 Artificial Intelligence

B.6 Functional Programming

B.7 Open Source Projects Mentioned in this Book

Appendix C: C A Brief History of Swift

C.1 A Brief History of Programming Language Paradigms Incorporated in Swift

C.2 Programming Languages at Apple before Swift

C.3 Swift History

C.3.1 Milestones

C.3.2 Swift on Other Platforms

C.4 Swift Future Directions

About the Technology

Apple's Swift language is the de-facto standard for iOS and Mac development, and it's rapidly becoming a great choice for any general-purpose programming task. Swift empowers you to use Object-oriented, Protocol-oriented, and Functional approaches to development, meaning you can choose the best programming style for the task without switching languages mid-stream. By exploring these classic computer science problems in Swift, you'll deepen your skill as a programmer and also discover the breadth of the fantastic Swift language in way that's far more interesting and engaging than the typical language reference.

What's inside

  • Search algorithms including breadth-first search, depth-first search, and A*
  • Constraints satisfaction problems
  • Common techniques for solving graph problems
  • Implementing genetic algorithms
  • K-means clustering
  • Simple neural networks

About the reader

Written for developers comfortable with the basics of Swift and interested in learning proven problem-solving techniques, deepening their knowledge of computer science, or preparing for coding interviews, while expanding their Swift skillset.

About the author

David Kopec is an Assistant Professor of Computer Science & Innovation at Champlain College in Burlington, VT. He is an experienced iOS developer and the author of Dart for Absolute Beginners.


Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
Buy
MEAP combo $39.99 pBook + eBook + liveBook
MEAP eBook $31.99 pdf + ePub + kindle + liveBook

FREE domestic shipping on three or more pBooks