|
|
@ -14,7 +14,7 @@
|
|
|
|
//!
|
|
|
|
//!
|
|
|
|
//! That being said, there are some areas I would love to improve upon/include:
|
|
|
|
//! That being said, there are some areas I would love to improve upon/include:
|
|
|
|
//! - Write idiomatic code.
|
|
|
|
//! - Write idiomatic code.
|
|
|
|
//! - Effectively use macros to reduce large portions of repetitive code.
|
|
|
|
//! - Effectively use [macro_rules!] to reduce large portions of repetitive code.
|
|
|
|
//! - Implement a **pretty_print()** function to display the binary search trees nicely.
|
|
|
|
//! - Implement a **pretty_print()** function to display the binary search trees nicely.
|
|
|
|
//! - Implement [Drop] trait for iterative node cleanup.
|
|
|
|
//! - Implement [Drop] trait for iterative node cleanup.
|
|
|
|
//! - Pre-allocate space on the heap for nodes to reduce inefficiency of inserts.
|
|
|
|
//! - Pre-allocate space on the heap for nodes to reduce inefficiency of inserts.
|
|
|
@ -356,8 +356,7 @@ pub trait BinarySearchTree<T: Ord> {
|
|
|
|
fn into_level_order_iter(self) -> IntoIter<T>;
|
|
|
|
fn into_level_order_iter(self) -> IntoIter<T>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// A Recursive Binary Search Tree implementation, defined as `RecursiveBST<T>` where T _must_
|
|
|
|
/// Recursive Binary Search Tree implementation.
|
|
|
|
/// implement trait [Ord].
|
|
|
|
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// # Important
|
|
|
|
/// # Important
|
|
|
|
///
|
|
|
|
///
|
|
|
@ -372,8 +371,7 @@ pub struct RecursiveBST<T: Ord> {
|
|
|
|
size: usize,
|
|
|
|
size: usize,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// An Iterative Binary Search Tree implementation, defined as `IterativeBST<T>` where T _must_
|
|
|
|
/// Iterative Binary Search Tree implementation.
|
|
|
|
/// implement trait [Ord].
|
|
|
|
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// # Important
|
|
|
|
/// # Important
|
|
|
|
///
|
|
|
|
///
|
|
|
|