Skip to content

sgowda97/searching-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

searching-java

Linear and Binary searching methods in Java

HOW-TO:

  • Make sure JDK is installed.
  • After downloading, go into the directory of the sorting program you'd like to use
  • Assuming you want to use linear search, while in the directory in CLI, type:
    • javac LinearSearch.java
    • java LinearSearch
  • Follow the instructions.

Linear Search

  • Known as the simplest searching program and best use for smaller elements array only
  • Array is traversed from first element to last element
  • Current element is compared with the given element to find, returns the index of the element

Binary Search

  • Faster than linear search
  • Array list MUST be in sorted order (if you input unsorted array, the program automatically sorts the array)
  • Follows the divide and conquer strategy and matches the middle element of the divided array

About

Linear and Binary searching methods in Java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages