X-Git-Url: https://i11git.iti.kit.edu/anon-gitweb/?p=Mitarbeiter%2FTim-Zeitz%2Fstud-rust-base.git;a=blobdiff_plain;f=src%2Findex_heap.rs;h=c086dc31f158e71a4f8f9d292595a58f00e54d49;hp=2f608d9d24760f339de13ea536d3b729cf1ca28f;hb=c56a14307218fbb51ad188826a431cd034cce473;hpb=dd14e61875eedc443d6004db819562a9b7f98a14 diff --git a/src/index_heap.rs b/src/index_heap.rs index 2f608d9..c086dc3 100644 --- a/src/index_heap.rs +++ b/src/index_heap.rs @@ -19,7 +19,6 @@ const TREE_ARITY: usize = 4; const INVALID_POSITION: usize = std::usize::MAX; impl IndexdMinHeap { - #[allow(dead_code)] pub fn new(max_id: usize) -> IndexdMinHeap { IndexdMinHeap { positions: vec![INVALID_POSITION; max_id], @@ -35,12 +34,10 @@ impl IndexdMinHeap { self.len() == 0 } - #[allow(dead_code)] pub fn contains_index(&self, id: usize) -> bool { self.positions[id] != INVALID_POSITION } - #[allow(dead_code)] pub fn clear(&mut self) { for element in &self.data { self.positions[element.as_index()] = INVALID_POSITION; @@ -48,12 +45,10 @@ impl IndexdMinHeap { self.data.clear(); } - #[allow(dead_code)] pub fn peek(&self) -> Option<&T> { self.data.first() } - #[allow(dead_code)] pub fn pop(&mut self) -> Option { self.data.pop().map(|mut item| { self.positions[item.as_index()] = INVALID_POSITION; @@ -67,7 +62,6 @@ impl IndexdMinHeap { }) } - #[allow(dead_code)] pub fn push(&mut self, element: T) { assert!(!self.contains_index(element.as_index())); let insert_position = self.len(); @@ -79,7 +73,6 @@ impl IndexdMinHeap { // Updates the key of an element if the new key is smaller than the old key. // Does nothing if the new key is larger. // Undefined if the element is not part of the queue. - #[allow(dead_code)] pub fn decrease_key(&mut self, element: T) { let position = self.positions[element.as_index()]; self.data[position] = element; @@ -89,7 +82,6 @@ impl IndexdMinHeap { // Updates the key of an element if the new key is larger than the old key. // Does nothing if the new key is smaller. // Undefined if the element is not part of the queue. - #[allow(dead_code)] pub fn increase_key(&mut self, element: T) { let position = self.positions[element.as_index()]; self.data[position] = element;