A implementation of classical data structures and algorithms in Apple's newly released Swift 2.
Implemented data structures and algorithms including
- Linked list
- Singly linked list
- Doubly linked list
- Tree
- Binary search tree
- Splay tree
- Red-black tree
- Sorting
- Bubble sort
- Insertion sort
- Selection sort
- Merge sort
- Quick sort
- Encryption and encoding
- MD5
- SHA-1
- Base64
- Graph
- Undirected/directed graph
- Unweighted/weighted graph
- Breath first search
- Depth first searsh
- Dijkstra's algorithm
- Bellman-Ford algorithm
- Others
- Stack
- Queue
- Binary heap
- Selection algorithm
with more on the way.
Simply import all the source files to your project and you're on your way. Unit test code shall give you a sense of how to use the classes.
Notice that some classes are subclassing or including others to take advantage of code reuse. So be sure to check out their dependenies if you only want to import a few of them (which I believe to be a nasty task given Swift does not have #import
s like Objective-C).
SwiftDataStructuresAndAlgorithms
is released under the MIT License. Pull requests are welcomed. Suggestions are greatly appreciated by open issues or drop me a email.