MCPcopy Index your code
hub / github.com/douchuan/algorithm / keys

Function keys

src/tree/binary/bst.rs:286–309  ·  view source on GitHub ↗

add the keys between lo and hi in the subtree rooted at x to the queue

(
    x: Option<NonNull<Node<K, V>>>,
    queue: &mut Vec<&'a K>,
    lo: &K,
    hi: &K,
)

Source from the content-addressed store, hash-verified

284/// add the keys between lo and hi in the subtree rooted at x
285/// to the queue
286pub fn keys<'a, K: 'a, V: 'a>(
287 x: Option<NonNull<Node<K, V>>>,
288 queue: &mut Vec<&'a K>,
289 lo: &K,
290 hi: &K,
291) where
292 K: Ord,
293{
294 let x = NodeQuery::new(x);
295 if x.is_some() {
296 let xkey = x.get_key().unwrap();
297 let cmplo = lo.cmp(xkey);
298 let cmphi = hi.cmp(xkey);
299 if cmplo.is_lt() {
300 keys(x.left().node, queue, lo, hi);
301 }
302 if cmplo.is_le() && cmphi.is_ge() {
303 queue.push(xkey);
304 }
305 if cmphi.is_gt() {
306 keys(x.right().node, queue, lo, hi);
307 }
308 }
309}

Callers 1

keysMethod · 0.70

Calls 6

is_someMethod · 0.80
get_keyMethod · 0.80
pushMethod · 0.80
cmpMethod · 0.45
leftMethod · 0.45
rightMethod · 0.45

Tested by

no test coverage detected