Skip to content
/ Strux Public

Well-tested, fully-documented data structures written in Swift that are compatible with Swift 4 and Swift 5.

License

Notifications You must be signed in to change notification settings

Ricks/Strux

Repository files navigation

Strux

Swift Versions SPM Compatible CocoaPods Version Test Coverage Documentation License: MIT

Well-tested, fully-documented, MIT-licensed data structures written in Swift that are compatible with Swift 4 and Swift 5. Currently it has four data structures:

Queue: a queue with O(1) addition and removal.

Heap: a min or max heap that can be used as a priority queue.

BSTree: a counted, self-balancing (AVL) binary search tree that conforms to the BidirectionalCollection protocol, with O(N) in-order traversal, and O(1) height, count, first, last, median, and (if the type is numeric) sum.

DisjointSet: A disjoint set data structure, also known as union-find, or merge-find.

Installation

Strux requires Swift 4.0 at a minimum and supports all subsequent Swift versions. Strux can be installed via the Swift Package Manager (SPM) or CocoaPods dependency managers (see below). I recommend SPM if you're not already using CocoaPods.

Add the following line to any Swift files that reference a Strux data structure:

import Strux

Alternatively you can add selected Strux source files to your project.

Swift Package Manager (SPM)

Use this repository as your dependency. In Xcode, navigate to File -> Swift Packages -> Add Package Dependency...

CocoaPods

Use the CocoaPod Strux. Here is a sample Podfile:

target 'MyProject' do
  pod 'Strux'
end

With the Podfile at the top-level directory of the project, enter:

pod install

About

Well-tested, fully-documented data structures written in Swift that are compatible with Swift 4 and Swift 5.

Resources

License

Stars

Watchers

Forks

Packages

No packages published