BinarySearchTree
public enum BinarySearchTree<Value> where Value : Comparable
extension BinarySearchTree: ExpressibleByArrayLiteral
Undocumented
-
Undocumented
Declaration
Swift
case empty -
Undocumented
Declaration
Swift
case leaf(Value) -
Undocumented
Declaration
Swift
indirect case node(BinarySearchTree, Value, BinarySearchTree) -
Undocumented
Declaration
Swift
public init<S>(_ sequence: S) where Value == S.Element, S : Sequence
-
Declaration
Swift
public var count: Int { get }Return Value
The amount of nodes contained herein.
-
Declaration
Swift
public var height: Int { get }Return Value
The height of this
BinarySearchTree. -
Complexity
O(n)
Declaration
Swift
public var inOrder: [Value] { get }Return Value
The values of the nodes contained herein in
inOrder(sorted) order. -
Declaration
Swift
public var minDescendent: BinarySearchTree { get }Return Value
The left-most descendent.
-
Declaration
Swift
public var maxDescendent: BinarySearchTree { get }Return Value
The right-most descendent.
-
Declaration
Swift
public func inserting(_ newValue: Value) -> BinarySearchTreeReturn Value
A
BinarySearchTreewith the givennewValueinserted in the appropriate place. -
Declaration
Swift
public func contains(_ value: Value) -> BoolReturn Value
trueif thisBinarySearchTreecontains the givenvalue. Otherwise,false. -
Declaration
Swift
public func search(for target: Value) -> BinarySearchTree?Return Value
The
BinarySearchTreewhich contains the giventarget, if it exists. Otherwise,nil. -
Declaration
Swift
public init(arrayLiteral elements: Value...)
View on GitHub
Install in Dash
BinarySearchTree Enumeration Reference