Skip to content
This repository has been archived by the owner on Dec 29, 2019. It is now read-only.

Linear Scarch Examaple #142

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Linear-Search-master.zip
Binary file not shown.
15 changes: 15 additions & 0 deletions java-linear-search/LinearSearchExample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
public class LinearSearchExample{
public static int linearSearch(int[] arr, int key){
for(int i=0;i<arr.length;i++){
if(arr[i] == key){
return i;
}
}
return -1;
}
public static void main(String a[]){
int[] a1= {10,20,30,50,70,90};
int key = 50;
System.out.println(key+" is found at index: "+linearSearch(a1, key));
}
}
9 changes: 9 additions & 0 deletions java-linear-search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@

# java-linear-search-3
<i>Easily understandable implementation</i>

# LimearScerchExample
<ol>
<li>Easy code</li>
<li>You will clearly understand</li>
</ol>