1
0
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:
Nicole L
2024-04-18 11:50:27 -07:00
committed by GitHub
parent e6021ce5d0
commit c9e08fae60
2 changed files with 3 additions and 3 deletions

View File

@ -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 {