Skip to content
Snippets Groups Projects
Commit 5f31bc23 authored by frederik stehli's avatar frederik stehli
Browse files

[min_max] fixed bwd search and added tests

parent a5778c5e
No related branches found
No related tags found
No related merge requests found
...@@ -329,10 +329,14 @@ impl MinMax { ...@@ -329,10 +329,14 @@ impl MinMax {
top_down = false; top_down = false;
block_search = true; block_search = true;
} else { } else {
if self.heap[current_node as usize * 2 + 2].max_excess - self.heap[current_node as usize * 2 + 2].min_excess >= look_for.abs() if self.heap[current_node as usize * 2 + 2].max_excess
- self.heap[current_node as usize * 2 + 2].min_excess
>= look_for.abs()
{ {
current_node = current_node * 2 + 2; current_node = current_node * 2 + 2;
} else if self.heap[current_node as usize * 2 + 1].max_excess - self.heap[current_node as usize * 2 + 1].min_excess >= look_for.abs() } else if self.heap[current_node as usize * 2 + 1].max_excess
- self.heap[current_node as usize * 2 + 1].min_excess
>= look_for.abs()
{ {
current_node = current_node * 2 + 1; current_node = current_node * 2 + 1;
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment