Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sheroz committed Sep 1, 2023
1 parent 0059a73 commit ec34be4
Showing 1 changed file with 3 additions and 34 deletions.
37 changes: 3 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,9 @@ Tree and parent-child relationship samples for learning purposes

Samples included:

- Generic Tree
- Binary Tree
- Binary Search Tree

## Generic Tree

```rust

pub struct Tree {
pub root: Option<TreeNodeRef>,
}

pub struct TreeNode {
pub uuid: Uuid,
pub number: u32,
pub text: String,
pub parent: TreeNodeWeakRef,
pub children: Option<Vec<TreeNodeRef>>,
}

pub type TreeNodeRef = Rc<RefCell<TreeNode>>;
pub type TreeNodeWeakRef = Weak<RefCell<TreeNode>>;
```

## Sample methods

- new
- add_child
- count
- search
- remove
- flatten

Please look at tests in [src/generic_tree.rs](src/generic_tree.rs) for more details
- [Generic Tree](src/generic_tree.rs)
- [Binary Tree](src/binary_tree.rs)
- [Binary Search Tree](src/binary_search_tree.rs)

## Useful insights

Expand Down

0 comments on commit ec34be4

Please sign in to comment.