Replies: 1 comment 1 reply
-
What about having a BinarySearch class, with each instance being initialised by receiving a function object. The class would have implemented the call magic method that would receive the left and right endpoints of the search + a few more arguments, such as:
These arguments could have default values to make it easier for classical applications. I would standardise the search this way:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We had this Pull Request for implementing the Binary Search algorithm. We closed it because we are trying to find a way, using object-oriented programming, to represent Binary Search in a wider scenario, not just to find an element in a sorted array.
Any thoughts about how should we proceed?
Beta Was this translation helpful? Give feedback.
All reactions