Reynald defines a binary search is: a search algorithm that finds the position of a target value within a sorted array. He explains how binary search compares the target value to the middle element of the array; if they are unequal, the half in which the target can’t lie is eliminated and the search continues on the remaining half until it is successful or the remaining half is empty. He then provides a visual representation so that the student is fully prepared to write their own version in the video that follows.
- [Instructor] Let's talk about…one of my favorite algorithms,…and it's one of my favorites because it's really quick…and pretty cool the way that it works.…I'm referring to binary search.…It's main purpose is to find the position…of a target value within a sorted array,…and that's important to remember,…the key word sorted because without it being sorted,…we're not able to implement this.…The way it does this is by comparing the target value…to the middle element of the array.…
If they are unequal, the half in which…the target can't be in is eliminated,…and the search continues…on the remaining half until it finds it.…Or it indicates it doesn't exist.…Let's take a look at this visually.…Let's say I'm searching for the number 88.…Our algorithm will look for the midpoint which is 80,…and then it'll compare to see if 88…is greater or less than 80.…If it turns out to be false,…that 88 won't be on the left hand side…because 88 is clearly greater than 80,…it's eliminated.…
So what you see here in gray with two through 80…
- Working with linked lists
- Creating a stack
- Defining a queue
- Performing a binary search
- Finding target values with a linear search
Skill Level Beginner
1. Algorithms and Data Structure Overview
Reasons for this course1m 26s
2. Linked List
5. Binary Search
6. Linear Search
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.