AVLTree
public struct AVLTree<Key, Value> where Key : Comparable
extension AVLTree: ExpressibleByArrayLiteral
extension AVLTree: Equatable where Value: Equatable
Copy-on-write self-balancing binary search tree.
-
The root node of this
AVLTree
.Declaration
Swift
public var root: AVLTree<Key, Value>.Node?
-
Creates an
AVLTree
with the givenkey
andvalue
for theroot
node.Declaration
Swift
@inlinable public init(key: Key, value: Value)
-
Creates an
AVLTree
with the givensequence
of key-value pairs.Declaration
Swift
@inlinable public init<S>(_ sequence: S) where S : Sequence, S.Element == (Key, Value)
-
Declaration
Swift
@inlinable public var inOrder: [(Key, Value)] { get }
Return Value
An array of key-value pairs in sorted order.
-
Inserts the given
value
for the givenkey
.Declaration
Swift
@inlinable public mutating func insert(_ value: Value, forKey key: Key)
-
Creates an
AVLTree
with an array literal of key-value pairs.Declaration
Swift
public init(arrayLiteral elements: (Key, Value)...)