BinarySearch_Slide1

Add to Favourites
Post to:

Description
What is Binary Search ?

Comments
Presentation Transcript Presentation Transcript

Binary Search : Binary Search This method is applicable only when the list or the array is sorted i.e. when the array is arranged in ascending or descending order. Binary means two Therefore, in binary search method, the data is searched by dividing the list or array into two groups. First the data to be searched is compared with the middle item of the list. If a match is found then the search is over otherwise the array is divided into two halves and checked in which half port ( upper / lower) of the array is the data present. i.e. in the upper half of the list or in the lower half of the list. In case, the array is arranged in descending order and the data is greater than the middle item , then it means the data lies in the upper half of the list, other wise the data is in the lower half of the list. a) If the data lies in the upper half of the list, then the data is compared with the middle item of the upper half of the list. If a match is found then the search is over, otherwise the process (i.e. dividing the resultant list into two halves, determining in which half the data is lying, and comparing the data with the middle item of the resultant list ) is continued till the list gets over. b) If the data lies in the lower half of the list then the data is compared with the middle item of the lower half of the list . If a match is found then the search is over, otherwise the process (i.e. dividing the resultant list into two halves, determining in which half the data is lying, and comparing the data with the middle item of the resultant list ) is continued till the list gets over. At any step if a match is found then the search gets over there itself. But if no match is found till the list is left with a single element, then it means the data is not present in the list.

Want to learn?

Sign up and browse through relevant courses.

Name:
Your Email:
Password:
Country:
Contact no:


Area code Number
Subjects you are interested in:
Word verification: (Enter the text as in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy
5 Members Recommend
46 Followers

Your Facebook Friends on WizIQ

Give live classes, create & sell online courses

Try it free Plans & Pricing

Connect