MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / min

Method min

code/chapter07/bst.rs:149–158  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

147 }
148
149 fn min(&self) -> (Option<&T>, Option<&U>) {
150 // 最小值一定在最左侧
151 match &self.left {
152 Some(node) => node.min(),
153 None => match &self.key {
154 Some(key) => (Some(&key), self.val.as_ref()),
155 None => (None, None),
156 },
157 }
158 }
159
160 fn max(&self) -> (Option<&T>, Option<&U>) {
161 // 最大值一定在最右侧

Callers 1

exponential_searchFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected