Bifalgorithm post · Computer science one · Searching
What are the requirements for using binary search in Java?
What are the requirements for using binary search in Java? (Computer science one · Searching) — "The Arrays and Collections classes provide many variations on…
Ideas in this flowchart
- Arrays and Collections provide many variations of binary-search methods.
- These methods require the searched array or List to be sorted appropriately.
- Binary search cannot be used on a Set because it is unordered.
- The Arrays class provides several binarySearch() methods.
- There is a binarySearch() variation for each primitive type.
- Some variations search within a specified range of elements.
- The most generally useful version is introduced next.