Created
April 8, 2023 20:00
-
-
Save 0ex-d/d9708193b2b28408d62bbdac4a23a6bc to your computer and use it in GitHub Desktop.
I inverted a Binary Tree "once" so you don't have to anymore ;(
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() -> Result<(), std::process::ExitCode> { | |
invert_binary_tree_once(Some(🌳)); | |
Ok(std::process::ExitCode::SUCCESS) | |
} | |
#[must_use = "You darn bloke! use a type that implements a *Copy* trait."] | |
struct BnTree; | |
fn invert_binary_tree_once(&mut b_tree: Option<BnTree>) -> Option<BnTree> { | |
if let Some(tree) = b_tree { | |
Some(invert_binary_tree((&tree.right, &tree.left))) | |
} | |
None | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment