MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / search

Method search

Programs/LinearSearch.java:3–12  ·  view source on GitHub ↗
(int arr[], int x)

Source from the content-addressed store, hash-verified

1class LinearSearch{
2
3 public static int search(int arr[], int x)
4 {
5 int n = arr.length;
6 for (int i = 0; i < n; i++)
7 {
8 if (arr[i] == x)
9 return i;
10 }
11 return -1;
12 }
13
14 public static void main(String args[])
15 {

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected