You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-07-10 16:20:15 +02:00
Slightly simplify binary tree exercise (#2002)
Give students a little more context for the binary tree exercise by giving them the wrapper methods on `BinaryTree` at the start and explicitly asking them to implement the methods on `Subtree`. I think this simplifies the exercise a bit and makes it a bit more focused for students.
This commit is contained in:
@ -35,7 +35,6 @@ struct Subtree<T: Ord>(Option<Box<Node<T>>>);
|
||||
pub struct BinaryTree<T: Ord> {
|
||||
root: Subtree<T>,
|
||||
}
|
||||
// ANCHOR_END: types
|
||||
|
||||
impl<T: Ord> BinaryTree<T> {
|
||||
fn new() -> Self {
|
||||
@ -54,6 +53,7 @@ impl<T: Ord> BinaryTree<T> {
|
||||
self.root.len()
|
||||
}
|
||||
}
|
||||
// ANCHOR_END: types
|
||||
|
||||
impl<T: Ord> Subtree<T> {
|
||||
fn new() -> Self {
|
||||
|
Reference in New Issue
Block a user