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

Function preorder

publication/code/chapter08/avl.rs:410–419  ·  view source on GitHub ↗

前中后层序遍历: 外部实现

(avl: &AvlTree<T>)

Source from the content-addressed store, hash-verified

408
409// 前中后层序遍历: 外部实现
410fn preorder<T: Clone + Ord + Debug>(avl: &AvlTree<T>) {
411 match avl {
412 Null => (),
413 Tree(node) => {
414 println!("key: {:?}", node.key);
415 preorder(&node.left);
416 preorder(&node.right);
417 },
418 }
419}
420
421fn inorder<T: Clone + Ord + Debug>(avl: &AvlTree<T>) {
422 match avl {

Callers 1

orderFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected