Merge pull request #24 from zacharyjones123/master

Added JavaDoc to BinarySearch.java
This commit is contained in:
Anup Kumar Panwar 2017-04-17 20:07:13 +05:30 committed by GitHub
commit 51054645c2

View File

@ -1,10 +1,23 @@
import java.util.Scanner;
/**
* Implements a Binary Search in Java
*
* @author unknown
*/
class BinarySearch
{
/**
* This method implements the Binary Search
*
* @param array The array to make the binary search
* @param key The number you are looking for
* @param lb The lower bound
* @param up The upper bound
* @return the location of the key
**/
public static int BS(int array[], int key, int lb, int ub)
{
if (lb>ub)
{ if (lb>ub)
{
return -1;
}
@ -25,6 +38,14 @@ class BinarySearch
}
}
/**
* This is the main method of Binary Search
*
* @author Unknown
* @param args Command line parameters
*/
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
@ -50,4 +71,4 @@ class BinarySearch
System.out.println("Not found");
}
}
}
}