Join Joe Marini for an in-depth discussion in this video Ordered list search, part of Programming Foundations: Algorithms.
- [Narrator] Searching for data in an ordered,…or sorted list, is much more efficient…than for an unordered list.…And that's because we have a valuable piece of information…about the list and the items in it,…which is the fact that it's sorted.…With a sorted list, we can perform a type of search…is called a binary search.…So, let's imagine we had a list of sorted numbers,…and the number that we're searching for is the number 41.…To perform the binary search,…we start off with two indexes…at the beginning and end of the list,…and then we calculate the midpoint of the list,…rounded down in case of an uneven division,…and then we check to see if that value at the midpoint…is the value that we want,…and if it is, then great, we return that index.…
Now, if the number at that index is less…than the one that we're searching for,…we know that we can ignore all the numbers below that index,…and conversely if that number is larger…than the one we're looking for,…we can ignore all the numbers above that index.…So, now we calculate the new midpoint by advancing,…
Author
Released
11/8/2018- Measuring algorithm performance
- Working with data structures such as arrays, stacks, and queues
- Looping and recursion
- Sorting data
- Searching data
- Filtering and value counting with hash tables
Skill Level Beginner
Duration
Views
-
Introduction
-
What you should know1m 35s
-
1. Overview
-
What are algorithms?2m 44s
-
-
2. Common Data Structures
-
Arrays2m 29s
-
Linked lists2m 36s
-
Linked lists walkthrough7m 35s
-
Stacks and queues2m 43s
-
Hash tables7m 59s
-
3. Recursion
-
Understanding recursion3m 38s
-
Simple recursion example3m 9s
-
Power and factorial4m 14s
-
-
4. Sorting Data
-
Overview of sorting2m 4s
-
The bubble sort5m 8s
-
The merge sort2m 24s
-
Implement the merge sort5m 10s
-
The quicksort3m 31s
-
Implement the quicksort5m 39s
-
-
5. Searching Data
-
Unordered list search3m 45s
-
Ordered list search5m 30s
-
-
6. Other Algorithms
-
Find max value recursively3m 44s
-
Conclusion
-
Next steps1m 18s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Ordered list search