Question: Write a program in Rust, following the instructions below (Any help will be appreciated) Implement a [binary search tree](https://en.wikipedia.org/wiki/Binary_search_tree) that supports insert, search, and [traversal](https://en.wikipedia.org/wiki/Tree_traversal).

Write a program in Rust, following the instructions below (Any help will be appreciated)

Implement a [binary search tree](https://en.wikipedia.org/wiki/Binary_search_tree) that supports insert, search, and [traversal](https://en.wikipedia.org/wiki/Tree_traversal). ## Public API Your program must provide the following public API. ``` pub struct Tree { ... } impl Tree { /// Creates an empty tree pub fn new() -> Self { unimplemented!() } /// Returns `false` if `key` already exists in the tree, and `true` otherwise. pub fn insert(&mut self, key: T) -> bool { unimplemented!() } /// Returns `true` if `key` exists in the tree, and `false` otherwise. pub fn find(&self, key: &T) -> bool { unimplemented!() } /// Returns the preorder traversal of the tree. pub fn preorder(&self) -> Vec<&T> { unimplemented!() } /// Returns the inorder traversal of the tree. pub fn inorder(&self) -> Vec<&T> { unimplemented!() } /// Returns the postorder traversal of the tree. pub fn postorder(&self) -> Vec<&T> { unimplemented!() } } ``` 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!