About 607,000 results
Open links in new tab
  1. Java Program for Linear Search - GeeksforGeeks

    Apr 9, 2025 · Given an array a [] of n elements, write a function to search for a given element x in a [] and return the index of the element where it is present. If the element is not present in the …

  2. Linear Search on Array - Java - Stack Overflow

    Aug 19, 2015 · Declaring an array variable, creating an array, and assigning the reference of the array to the variable can be combined in one statement, as shown below: String[] arrayRefVar …

  3. Linear Search in Java with Examples - Javacodepoint

    Jan 5, 2025 · Linear Search is a simple search algorithm that scans the array sequentially and compares each element with the key (target value). If the key is found, it returns the index; …

  4. Linear Array Search in Java - Scientech Easy

    Feb 12, 2025 · If a match is found, the search terminates and returns the index of the element in the array that matches the key. If no match is found, the search returns -1 or some other value …

  5. Java Program to Perform a Linear Search - 3 Ways - Tutorial

    Write a Java program to perform a linear search on arrays using the for loop traverses array and if statement, and functions with examples.

  6. Linear Search in Java - Tpoint Tech

    Jan 11, 2025 · Step 1: Traverse over the array. Step 2: Match the key element with array element. Step 3: If key element is found, return the index position of the array element. Step 4: If key …

  7. Linear Search in Java - Scaler Topics

    Aug 22, 2022 · Linear Search in Java is the simplest and most basic searching algorithm. It is used to find the index of the desired element in an array. In this algorithm, we sequentially visit …

  8. Java Program for Linear Search with Example - Codez Up

    Sep 6, 2021 · array[i] = input.nextInt(); } System.out.println("Enter the search value:"); int searchElement = input.nextInt(); for (int i = 0; i < length; i++) { if (array[i] == searchElement) { …

  9. Java Linear Search Algorithm - CompSci.Rocks

    Here is the basic pseudocode for the linear search algorithm: if item == target value. return the index of the item. As you can see, the algorithm loops through each element in the array and …

  10. Linear Search in Java - Java2Blog

    Nov 15, 2023 · Linear search is simple sequential search in which target element is searched one by one in the array. If element is found in the array then index will be returned else -1 will be …

  11. Some results have been removed
Refresh