-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Background
Current iterators perform an initial descent to the leftmost leaf. To match BTreeMap’s “fully lazy” behavior, we need to defer any work until next() is called and support reverse iteration.
Goals
- Eliminate pre-computation before the first
next()call. - Support reverse traversal via
DoubleEndedIterator. - Add lower/upper bound seeking methods.
Tasks
- Refactor
Iterso that it only builds its traversal stack on the firstnext()call. - Implement
DoubleEndedIteratorby maintaining two stacks (one for forward, one for backward). - Add
seek_lower_bound(&mut self, key: &K)andseek_upper_bound(&mut self, key: &K)methods. - Write unit tests covering:
- Forward iteration matches the in-order sequence.
- Reverse iteration (
.rev()) yields keys in descending order. seek_lower_bound(&k)positions at the first key ≥k, andseek_upper_bound(&k)at the first key >k.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels