pub trait ShowBinaryTree<P> {
// Required methods
fn get_left(&self, ptr: &P) -> Option<P>;
fn get_right(&self, ptr: &P) -> Option<P>;
fn get_root(&self) -> Option<P>;
fn print_node(&self, ptr: &P) -> String;
// Provided methods
fn print_inner(
&self,
ptr: P,
fill: &mut Vec<&'static str>,
last: &'static str,
) { ... }
fn print_as_binary_tree(&self) { ... }
}Expand description
2分木を整形して表示する
Required Methods§
Sourcefn print_node(&self, ptr: &P) -> String
fn print_node(&self, ptr: &P) -> String
<required> ノードの値を表示する
Provided Methods§
Sourcefn print_inner(&self, ptr: P, fill: &mut Vec<&'static str>, last: &'static str)
fn print_inner(&self, ptr: P, fill: &mut Vec<&'static str>, last: &'static str)
再帰的にprintを行う
Sourcefn print_as_binary_tree(&self)
fn print_as_binary_tree(&self)
2分木としてフォーマットする