SwiftStructures Versions Save

Examples of commonly used data structures and algorithms in Swift.

v4.1

6 years ago

This is a quick note announcing an updated version of the Swift Algorithms Book. For those who’ve previously purchased the PDF version, all reference materials (including further reading) are now hyperlinked. Chapter headings are also clickable to specific sections in the document. Changes to both the EPUB and PDF versions include the following:

Revised LinkList.remove(at:) algorithm Renamed methods for HashTable algorithm and Keyable Protocol Revised content for Stacks & Queues Revised content for Basic Sorting

v4.0

6 years ago

Swift 4.0 is now officially released! As a result, The Swift Algorithms project has been updated to reflect this new standard.

Change Summary

The relative stability of Swift 4.0 has allowed an opportunity refine many areas of the code base. Notable updates include:

  • New examples of code Memoization and Dynamic Programming
  • New non-recursive Binary Search Tree Algorithm (BST)
  • New contains() method for BST's.
  • New generic min/max Heap Algorithm
  • New unit test cases for evaluating Fibonacci and Heap Algorithms
  • subscript syntax applied to Trie and Linked List algorithms
  • Support for new Swift-based Array.swapAt function
  • Limited use of Implicit Unwrapped Optionals (IUO's)

Existing Swift 3.0 followers should study the new Swift 4.0 BST Algorithm. To simulate a call stack often employed in recursive processes, this model uses a custom Stack data structure in conjunction with inout variables.

Follow the latest Swift 4.0 code updates from the master branch. If you have questions or would like submit a pull request, please do so using the develop branch.

v3.0-beta.6

7 years ago

With the final version of Swift 3.0 soon to be announced, the algorithms project has been updated to reflect the latest standard!

Change Summary

This update incorporates final language changes to Swift 3.0. These include minor functional changes to declare inout parameters, optionals, cast operations and infix operators.

Branches

Follow the latest Swift 3.0 code updates here. While Swift 3.0 remains in beta, the master project branch will continue to support Swift 2.2.

v3.0-beta.3

7 years ago

With Swift 3.0 now available in beta, the algorithms project has been updated to reflect this new standard!

Change Summary

There have been many language refinements introduced with Swift 3.0. This has provided an opportunity to also refine numerous areas of the algorithms project. Notable Swift 3.0 proposals now supported include:

Existing Swift 2.2 followers should study the revamped Swift 3.0 collection indexing model. This implementation can seen with the refactored String extension and new Sortable protocol extension.

Additional Refinements

New Int and Array extensions have been added to support pre-existing Math and Sorting classes (respectively). Beyond centralizing specific operations, the new design now works directly with the recursive Enum project example. Finally, a general effort has been made to improve generics (where applicable). This includes refactoring Hash Tables (renamed Hash Lists) to support generic objects as well as the Search and Sorting algorithms.

Branches

Follow the latest Swift 3.0 code updates here. While Swift 3.0 remains in beta, the master project branch will continue to support Swift 2.2.

v2.2

8 years ago

With Swift 2.2 now available, the algorithms project has been updated to reflect this new standard!

Change Summary

This release mainly addresses legacy C-style syntax. With the pending removal of C-style loops as well as increment / decrement markers in Swift 3.0, Github examples for bubbleSort, insertionSort and selectionSort have been refactored. Minor updates were also made to queues, stacks and linked lists. While not officially published, the Math-based fibonacci methods were also updated to reflect non-mutating parameters.

v.2.1

8 years ago

With The Swift Algorithms Book now available in print, pdf and ePub formats, it's been great receiving feedback from people everywhere! One area of interest has been sorting and search. Beyond heaps, graphs and binary search trees (BST's), language newcomers have been curious to see how Swift handles traditional sorting algorithms like bubbleSort() and insertionSort().

Change Summary

Github examples for bubbleSort, insertionSort and selectionSort now support generic and non-generic implementations using the latest Swift 2 syntax. Also, two new versions of binarySearch are now available. To support these updates, SortingTest.swift has also been refactored to support generic and non-generic methods.

v2.0

8 years ago

The introduction of Swift 2.0 brings a new level of usability and concise syntax many have come to appreciate. As the referring source for The Swift Algorithms Book, the Github source has been updated to meet this new standard.

Change Summary

While most updates involved object mutability and basic syntax, significant refactoring was completed for the project extensions. Mainly used as helper functions for trie algorithms, readers should see little difference with the latest code and examples published in the book.

Along with code updates, this release also introduces a new algorithm called a Bloom Filter. Similar to a hash table, stay tuned for new documentation at waynewbishop.com that describes this process.