# Condense and extend std.Treap's traversal functionalities\. \(\#20002\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/4a77c7f2588ce42c10df53fc1242f684ff506720)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 4a77c7f2588ce42c10df53fc1242f684ff506720

Requested commit: 4a77c7f2588ce42c10df53fc1242f684ff506720

Commit: 4a77c7f2588ce42c10df53fc1242f684ff506720

Tree: f2f4e9cca8b4ac34939a2490c17029a9db4800d7

Author: Cheng Sheng

Committer: GitHub

## Message

```
Condense and extend std.Treap's traversal functionalities. (#20002)

The core functionalities are now in two general functions
`extremeInSubtreeOnDirection()` and `nextOnDirection()` so all the other
traversing functions (`getMin()`, `getMax()`, and `InorderIterator`) are
all just trivial calls to these core functions.

The added two functions `Node.next()` and `Node.prev()` are also just
trivial calls to these.

* std.Treap traversal direction: use u1 instead of usize.

* Treap: fix getMin() and getMax(), and add tests for them.
```

## Parents

- [d1d95294fd657f771657ea671a6984b860347fb0](https://git.cafe/gitcafe/zig/commit/d1d95294fd657f771657ea671a6984b860347fb0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/4a77c7f2588ce42c10df53fc1242f684ff506720?format=markdown)
