pub enum TreeError {
Nondeterministic(TraversalType, TraversalType),
LeetcodeFormatError,
}
Expand description
Error when constructing a binary tree.
Variants§
Nondeterministic(TraversalType, TraversalType)
The tree structure cannot be determined by given two order. Theoretically, if every value occurs no more than once, a binary tree can be determined iif its in-order and another(pre-order, post-order or level-order) sequence are provided.
Note that in some special cases a tree can also be determined(eg., pre-order and post-order
both are “[1]”), but these cases are not handled and the corresponding Nondeterministic
error will be returned.
LeetcodeFormatError
Parsing leetcode-format tree failed. It is either because you miss the square bracket, or
if there is an element split by “,” that cannot be parsed to i32
.
Trait Implementations§
impl Eq for TreeError
impl StructuralPartialEq for TreeError
Auto Trait Implementations§
impl Freeze for TreeError
impl RefUnwindSafe for TreeError
impl Send for TreeError
impl Sync for TreeError
impl Unpin for TreeError
impl UnwindSafe for TreeError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more