https://github.com/matthewfaller/algorithm-practice
A series of practice algorithms implemented in Swift.
https://github.com/matthewfaller/algorithm-practice
algorithms data-structures swift swift-language
Last synced: 3 months ago
JSON representation
A series of practice algorithms implemented in Swift.
- Host: GitHub
- URL: https://github.com/matthewfaller/algorithm-practice
- Owner: matthewfaller
- License: mit
- Created: 2018-08-26T00:13:33.000Z (over 7 years ago)
- Default Branch: develop
- Last Pushed: 2018-09-23T04:58:34.000Z (over 7 years ago)
- Last Synced: 2025-01-20T09:09:03.898Z (about 1 year ago)
- Topics: algorithms, data-structures, swift, swift-language
- Language: Swift
- Homepage:
- Size: 161 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Algorithms & Data Structures
[](https://travis-ci.com/matthewfaller/algorithm-practice)
[](https://matthewfaller.github.io/algorithm-practice/)
Programming practice implemented in Swift
## Running The Project
```bash
git clone https://github.com/matthewfaller/algorithm-practice
```
```bash
cd algorithm-practice/
```
```bash
swift test
```
### Linked List
A simple implementation of a classic structure
```swift
let list = LinkedList()
list.append("Hello")
list.append("World!")
```
Conforms to the `Sequence` Protocol
```swift
let numbers: LinkedList = [1, 2, 3, 4]
let factorial = numbers.reduce(1, *)
print(factorial)
24
```
Uses generics
```swift
struct User: Codable, Hashable {
let id: String
let name: String
}
let users: LinkedList = [
User(id: "1", name: "Emily Blunt"),
User(id: "2", name: "John Krasinski")
]
users.filter(isActor).forEach(updateUser)
```