Welcome to Algorithm
Algorithm is a library of tools that is used to create intelligent applications.
Features
- [x] Probability Tools
- [x] Expected Value
- [x] Programmable Probability Blocks
- [x] Array Extensions
- [x] Set Extensions
Data Structures
- [x] DoublyLinkedList
- [x] Stack
- [x] Queue
- [x] Deque
- [x] RedBlackTree
- [x] SortedSet
- [x] SortedMultiSet
- [x] SortedDictionary
- [x] SortedMultiDictionary
Requirements
- iOS 8.0+ / Mac OS X 10.9+
- Xcode 8.0+
Communication
- If you need help, use Stack Overflow. (Tag 'cosmicmind')
- If you'd like to ask a general question, use Stack Overflow.
- If you found a bug, and can provide steps to reliably reproduce it, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Installation
Embedded frameworks require a minimum deployment target of iOS 8.
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
To integrate Algorithm's core features into your Xcode project using CocoaPods, specify it in your Podfile
:
Then, run the following command:
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
To integrate Algorithm into your Xcode project using Carthage, specify it in your Cartfile:
Run carthage update
to build the framework and drag the built Algorithm.framework
into your Xcode project.
Changelog
Algorithm is a growing project and will encounter changes throughout its development. It is recommended that the Changelog be reviewed prior to updating versions.
Samples
The following are samples to see how Algorithm may be used within your applications.
- Visit the Samples repo to see example projects using Algorithm.
Probability
Each data structure within Algorithm is equipped with probability tools.
Basic Probability
For example, determining the probability of rolling a 3 using a die of 6 numbers.
Conditional Probability
For conditional probabilities that require a more complex calculation, use block statements.
Expected Value
The expected value of rolling a 3 or 6 with 100 trials using a die of 6 numbers.
DoublyLinkedList
The DoublyLinkedList data structure is excellent for large growing collections of data. Below is an example of its usage.
Stack
The Stack data structure is a container of objects that are inserted and removed according to the last-in-first-out (LIFO) principle. Below is an example of its usage.
Queue
The Queue data structure is a container of objects that are inserted and removed according to the first-in-first-out (FIFO) principle. Below is an example of its usage.
Deque
The Deque data structure is a container of objects that are inserted and removed according to the first-in-first-out (FIFO) and last-in-first-out (LIFO) principle. Essentially, a Deque is a Stack and Queue combined. Below are examples of its usage.
RedBlackTree
A RedBlackTree is a Balanced Binary Search Tree that maintains insert, remove, update, and search operations in a complexity of O(logn). The following implementation of a RedBlackTree also includes an order-statistic, which allows the data structure to be accessed using subscripts like an array or dictionary. RedBlackTrees may store unique keys or non-unique key values. Below is an example of its usage.
SortedSet
SortedSets are a powerful data structure for algorithm and analysis design. Elements within a SortedSet are unique and insert, remove, and search operations have a complexity of O(logn). The following implementation of a SortedSet also includes an order-statistic, which allows the data structure to be accessed using an index subscript like an array. Below are examples of its usage.
SortedMultiSet
A SortedMultiSet is identical to a SortedSet, except that a SortedMultiSet allows non-unique elements. Look at SortedSet for examples of its usage.
SortedDictionary
A SortedDictionary is a powerful data structure that maintains a sorted set of keys with value pairs. Keys within a SortedDictionary are unique and insert, remove, update, and search operations have a complexity of O(logn).
SortedMultiDictionary
A SortedMultiDictionary is identical to a SortedDictionary, except that a SortedMultiDictionary allows non-unique keys. Below is an example of its usage.
License
The MIT License (MIT)
Copyright (C) 2019, CosmicMind, Inc. http://cosmicmind.com.
All rights reserved.