About 991,000 results
Open links in new tab
  1. Find a String in given Array of Strings using Binary Search

    Apr 9, 2025 · Given a sorted array of Strings arr and a string x, The task is to find the index of x in the array using the Binary Search algorithm. If x is not present, return -1. Examples: …

  2. java - Implementing binary search on an array of Strings - Stack Overflow

    Aug 27, 2015 · public static int binarySearch(String[] a, String x) { int low = 0; int high = a.length - 1; int mid; while (low <= high) { mid = (low + high) / 2; if (a[mid].compareTo(x) < 0) { low = mid …

  3. Java Program to Implement Binary Search Algorithm

    Based on the input from user, we used the binary search to check if the element is present in the array. We can also use the recursive call to perform the same task.

  4. Binary Search Algorithm in Java - Baeldung

    Jun 6, 2024 · This tutorial demonstrated a binary search algorithm implementation and a scenario where it would be preferable to use it instead of a linear search. The code backing this article …

  5. Java String Binary Search Example - onlinetutorialspoint

    Jun 17, 2018 · Here we are going to find a specific element in a string array using Binary Search Algorithm. String Binary Search : Searching a string using binary search algorithm is …

  6. Implementing Binary Search in Java with Step-by-Step Code.

    3 days ago · Recursive Method in Java; Recursive Method in Java; I have implemented the Binary Search algorithm in both iterative and recursive ways. This post explains the concept of Binary …

  7. Binary Search in Java with Examples - Javacodepoint

    Jan 5, 2025 · Binary Search is an efficient algorithm for finding an element in a sorted array or collection. It works by repeatedly dividing the search interval in half and comparing the target …

  8. Binary Search in Java - GeeksforGeeks

    Apr 11, 2025 · Binary search is a highly efficient searching algorithm used when the input is sorted. It works by repeatedly dividing the search range in half, reducing the number of …

  9. How to Use Arrays.binarySearch() in Java - freeCodeCamp.org

    Aug 23, 2022 · In this article, I'm going to show you how to use the Arrays.binarySearch() method in Java. What is Arrays.binarySearch() in Java? According to the official docs on the …

  10. Binary Search Java Example - Java Code Geeks

    Jun 1, 2020 · Binary Search in Java is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the …

  11. Some results have been removed
Refresh