Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Saetch committed Jun 29, 2024
1 parent 7110eb4 commit 2334917
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Cluster/Node_cs/NodeBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ private static int BinarySearchFittingNode(List<NodeResponse> hashValues, int ai
int index = len/2;
int upperBound = len -1;
int lowerBound = 0;
int toPrint = 5;
Console.WriteLine("Binary searching for NodeResponses: ");
foreach (NodeResponse node in hashValues){
Console.WriteLine(node.name + " " + node.hash);
Expand All @@ -154,11 +155,17 @@ private static int BinarySearchFittingNode(List<NodeResponse> hashValues, int ai
}
if(aimedValue > currentValue){
lowerBound = index+1;
Console.WriteLine("Increasing lowerBound to: "+lowerBound);
if (toPrint > 0){
Console.WriteLine("Increasing lowerBound to: "+lowerBound);
toPrint--;
}
index += (upperBound - index)/2;
}else{
upperBound = index -1;
Console.WriteLine("Decreasing upperBound to: "+upperBound);
if (toPrint > 0){
Console.WriteLine("Decreasing upperBound to: "+upperBound);
toPrint--;
}
index -= Math.Max(1,(index - lowerBound)/2);
}
}
Expand Down

0 comments on commit 2334917

Please sign in to comment.