An open API service indexing awesome lists of open source software.

https://github.com/rapter1990/binary-search-example

Binary Search Example
https://github.com/rapter1990/binary-search-example

binarysearch java

Last synced: 10 months ago
JSON representation

Binary Search Example

Awesome Lists containing this project

README

          

Binary Search Example


  • This method is used to search the provided list for the specified object using the binary search algorithm. The list must be sorted into ascending order according to the specified natural number, prior to making the method call. If the list is not sorted, the results are undefined

  • This java example shows how to search an element of Java ArrayList using binarySearch method of Collections class. binarySearch method usesbinary search algorithm to search an element.

The objective of Program



  • The program firstly reads a long file containing above 90000 objects and set each object into the City and implement search process in terms of name of city, substring name of city and one character.

Files contaning in this repository



  • src

    • files

      • cities.txt

      • output.txt



    • main

      • Main.java



    • model

      • City.java



    • util

      • BinarySearch.java

      • ProcessMethod.java

      • ReadFile.java

      • ShowResult.java

      • WriteFile.java





Explaining an inforamtion of each file


Files Names
Information


cities.txt
Contaning the infomation of city (its weight,its name and lastly its country)


output.txt
Show the result of search process in terms of name of city, substring name of city and one character with being sensitive for lowercase and uppercase


Main.java
Handle with all project files to run the program


City.java
Defining it as a POJO


BinarySearch.java
Implementing search algorithm for name of city, substring name of city and one character


ProcessMethod.java
Managing all search algorithm via defined function


ReadFile.java
Reading cities.txt and assign each variable to City Object


ShowResult.java
Showing the search result


WriteFile.java
Writing all the search result into the output.txt