Concept
What are the requirements for using binary search in Java?
ComputerScienceOne / Searching
"The Arrays and Collections classes provide many variations on methods that implement binary search. All of these methods assume that the array or List being searched are sorted appropriately (you cannot use binary search on a Set as it is an unordered collection). The Arrays class provides several binarySearch() methods, one for each primitive type as well as variations that allow you to search within a specified range of elements. The most generally useful version is as follows:"
Related Ideas
- How does Java perform binary searches on arrays and lists?ComputerScienceOne · Sorted Collections
- How does binary search work with arrays and lists?ComputerScienceOne · Sorting
- How do the Arrays and Collections classes sort elements?ComputerScienceOne · Sorting
- How does a Comparator determine the order of two elements?ComputerScienceOne · Comparators
- What is the difference between Comparable and Comparator in Java?ComputerScienceOne · Comparators
- What are sorted collections in the Java Collections framework?ComputerScienceOne · Sorted Collections
- How do Java sets store unordered unique elements?ComputerScienceOne · Dynamic Data Structures
- What is the general searching problem?ComputerScienceOne · Searching