Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lrvideckis committed Jul 29, 2024
1 parent 191bff3 commit 8bef888
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/data_structures/binary_trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn main() {
trie.update(x, -1);
}
}
_ => println!("{}", trie.min_xor(x)),
_ => println!("{}", trie.walk(x)),
}
}
}
14 changes: 7 additions & 7 deletions src/data_structures/binary_trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ struct Node {
/// use programming_team_code_rust::data_structures::binary_trie::BinaryTrie;
///
/// let mut trie = BinaryTrie::default();
/// assert!(std::panic::catch_unwind(|| trie.min_xor(4)).is_err());
/// assert!(std::panic::catch_unwind(|| trie.walk(4)).is_err());
/// trie.update(1, 1);
/// assert!(std::panic::catch_unwind(|| trie.min_xor(4)).is_ok());
/// assert!(std::panic::catch_unwind(|| trie.walk(4)).is_ok());
/// trie.update(2, 1);
/// trie.update(3, 1);
/// trie.update(2, -1);
/// assert_eq!(trie.count(2), 0);
/// assert_eq!(trie.count(3), 1);
/// assert_eq!(trie.count(4), 0);
/// assert_eq!(trie.min_xor(0), 1);
/// assert_eq!(trie.min_xor(1), 0);
/// assert_eq!(trie.min_xor(2), 1);
/// assert_eq!(trie.min_xor(3), 0);
/// assert_eq!(trie.min_xor(4), 5);
/// assert_eq!(trie.walk(0), 1);
/// assert_eq!(trie.walk(1), 0);
/// assert_eq!(trie.walk(2), 1);
/// assert_eq!(trie.walk(3), 0);
/// assert_eq!(trie.walk(4), 5);
/// ```
pub struct BinaryTrie {
t: Vec<Node>,
Expand Down

0 comments on commit 8bef888

Please sign in to comment.