Trees
-
A value-semantic, immutable Tree structure with two generic types for the branches and leaves.
Example Usage
A
Tree
can 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: CustomStringConvertible
extension Tree: Equatable where Leaf: Equatable, Branch: Equatable
extension 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 : Comparable
extension BinarySearchTree: ExpressibleByArrayLiteral
-
Copy-on-write self-balancing binary search tree.
See moreDeclaration
Swift
public struct AVLTree<Key, Value> where Key : Comparable
extension AVLTree: ExpressibleByArrayLiteral
extension 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.
Useable only by
final class
types.Declaration
Swift
public protocol ReferenceTreeProtocol : AnyObject