From 99d91a624838624c9d9093dd6365dde4f9045707 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Tue, 22 Feb 2022 02:29:48 +0000 Subject: [PATCH] Add more documentation --- src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 952706b..eb50eb7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -167,7 +167,7 @@ pub trait BinarySearchTree { /// Removes the given value. /// - /// BST will not be modified if trying to remove element that does not exist. + /// Tree will not be modified if trying to remove element that does not exist. fn remove(&mut self, value: &T); /// Returns a reference to the element or `None` if element does not exist. @@ -196,10 +196,19 @@ pub trait BinarySearchTree { /// The height is: **2** fn height(&self) -> Option; + /// Returns a reference to the minimum element of the tree or `None` if tree is empty. fn min(&self) -> Option<&T>; + + /// Returns a reference to the maximum element of the tree or `None` if tree is empty. fn max(&self) -> Option<&T>; + + // Removes and returns the minimum element from the tree or `None` if tree is empty. fn remove_min(&mut self) -> Option; + + // Removes and returns the maximum element from the tree or `None` if tree is empty. fn remove_max(&mut self) -> Option; + + fn sorted_vec(&self) -> Vec<&T>; fn into_sorted_vec(self) -> Vec; fn pre_order_vec(&self) -> Vec<&T>;