Posts

Showing posts with the label Binary search

Write a program to accept the names of 10 cities in a single dimensional String array and their STD (Subscribers Trunk Dialing) codes in another single dimensional array integer array. Search for a name of a city input by the user in the list.If found, display "Search successful" and print the name of the city along with its STD code, or else display the message "Search Unsuccessful, no such city in the list".

Write a program in java to accept the year of graduation from school as an integer value from the user. Using the binary search technique on the sorted array of integers given below.Output the message "Record exist". If the value input is located in the array. If not, output the message "Record does not exist".{1982, 1987, 1993, 1996, 1999, 2003, 2006, 2007, 2009, 2010}.