Trees
-
A value-semantic, immutable Tree structure with two generic types for the branches and leaves.
Example Usage
A
Treecan be used in pretty simple cases:let justALeaf: Tree<(),Double> = .leaf(3.14159265359)Or more nested cases:
See morelet happyTree = Tree.branch("alpha", [ .leaf(1), .branch("beta", [ .leaf(2), .leaf(3), .leaf(4) ]), .leaf(5), .branch("gamma", [ .leaf(6), .branch("delta", [ .leaf(7), .leaf(8) ]) ]) ])Declaration
Swift
public enum Tree<Branch, Leaf>extension Tree: CustomStringConvertibleextension Tree: Equatable where Leaf: Equatable, Branch: Equatableextension Tree: Hashable where Leaf: Hashable, Branch: Hashable -
Implements a priority queue where minimum values have highest priority.
See moreDeclaration
Swift
public struct BinaryHeap<Element, Value> where Element : Hashable, Value : Comparable -
Undocumented
See moreDeclaration
Swift
public enum BinarySearchTree<Value> where Value : Comparableextension BinarySearchTree: ExpressibleByArrayLiteral -
Copy-on-write self-balancing binary search tree.
See moreDeclaration
Swift
public struct AVLTree<Key, Value> where Key : Comparableextension AVLTree: ExpressibleByArrayLiteralextension AVLTree: Equatable where Value: Equatable -
Mutable Tree structure.
See moreDeclaration
Swift
public class ReferenceTree -
Interface for nodes in tree structures.
Provides default implementations for many tree structure operations.
See moreUseable only by
final classtypes.Declaration
Swift
public protocol ReferenceTreeProtocol : AnyObject
View on GitHub
Install in Dash
Trees Reference