Skip to content

Commit

Permalink
Revert
Browse files Browse the repository at this point in the history
  • Loading branch information
apanda committed Jun 4, 2024
1 parent 5ee3c25 commit 5598109
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions treap_non_random/src/treap_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ where
}

/// Rotate the tree right.
#[no_alloc]
pub fn rotate_right(&mut self) {
// Get left subtree.
let l = mem::take(&mut self.left);
Expand All @@ -62,6 +63,7 @@ where
}

/// Rotate the tree left.
#[no_alloc]
pub fn rotate_left(&mut self) {
let r = mem::take(&mut self.right);
if let Some(mut q) = r {
Expand All @@ -76,6 +78,7 @@ where
/// Check heap property holds. The goal here is to make sure that
/// the root is always the largest value, and larger values propagate
/// up the tree.
#[no_alloc]
pub fn heap_check(&self, n: &Option<Box<TreapNode<T, P>>>) -> bool {
if let Some(node) = n {
node.element.priority() <= self.element.priority()
Expand Down Expand Up @@ -138,6 +141,7 @@ where
/// Get the node with value `e`. Note, we do not provide a
/// get with priorities, the tree is not set up to make that
/// lookup efficient.
#[no_alloc]
pub fn get(&self, e: T) -> Option<&Element<T, P>> {
match &self.element.value().cmp(&e) {
Ordering::Equal => Some(&self.element),
Expand All @@ -161,6 +165,7 @@ where
/// Delete a node with element `e`. Note, we cannot delete the root itself,
/// for one we might have nothing to replace it with. The Treap itself takes
/// care of this problem.
#[no_alloc]
pub fn delete(&mut self, e: &T) -> bool {
match &self.element.value().cmp(e) {
Ordering::Equal => {
Expand Down Expand Up @@ -193,6 +198,7 @@ where
}
}

#[no_alloc]
fn delete_child(&mut self, child: TreapChild) {
let done = {
let which = match child {
Expand Down

0 comments on commit 5598109

Please sign in to comment.