I got an assignment for my class to modify the Binary Search where the data is ordered in descending order. But I can't figure out how I'm supposed to modify it.
.
Here's my code :
(After changing your sample data to be ordered descending) there is only ONE line in your code where you compare data for non-equality against an interval position - change that.
Note that, for descending order, you may confuse yourself less if you rename the ends of the interval as left and right, rather than low and high.