Skip to content

Commit

Permalink
Update rbtree.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-shandar authored Jan 24, 2025
1 parent 8474c43 commit fad0d53
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions notes/rbtree.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ type Node<T> = {
```rust
enum List<T> {
None,
Some<&Node<T>> // compilation error but it doesn't matter for the article purpose.
Some<&Node<T>> // compilation error, but it doesn't matter for the article's purpose.
}

// or
type List<T> = Option<Node<T>>;
type List<T> = Option<&Node<T>>;

struct Node<T> {
value: T
Expand All @@ -31,7 +31,20 @@ struct Node<T> {

## Tree

```ts
type Tree<T> = Node<T> | null
type Node<T> = {
readonly left: Tree<T>
readonly value: T
readonlt right: Tree<T>
}
```
- computer
- in
```rust
type Tree<T> = Option<&Node<T>>;
struct Node<T> {
left: Tree<T>
value: T
right: Tree<T>
}
```

0 comments on commit fad0d53

Please sign in to comment.