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

Method min

publication/code/chapter08/bst.rs:204–213  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

202 }
203
204 fn min(&self) -> (Option<&T>, Option<&U>) {
205 // 最小值一定在最左侧
206 match &self.left {
207 Some(node) => node.min(),
208 None => match &self.key {
209 Some(key) => (Some(&key), self.val.as_ref()),
210 None => (None, None),
211 },
212 }
213 }
214
215 fn max(&self) -> (Option<&T>, Option<&U>) {
216 // 最大值一定在最右侧

Callers 2

exponential_searchFunction · 0.45
basicFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected