Reynald defines a linear search : a method for finding a target value within a list. He shows how it sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched. He then provides a visual representation so that the student is fully prepared to write their own version in the video that follows.
- [Instructor] It's time to talk about linear searches.…Now, a linear search is not too different…from a binary search in that it is a method…for finding a target value within a list.…However the big difference is that it's much less efficient,…because it checks each element of the list…for the target value until a match is found…or until all the elements are searched,…so there's no elimination of half of the array…and then searching just a portion of it.…
It checks every single slot,…and so that's why it's a lot less efficient.…If you look at this image here,…we're looking for the number five.…So we can start at the index of zero,…but we have to check the slot that contains 10,…and then eight, one, 21, seven, 32…until we reach five, and then we can stop.…It's important for you to know about linear search…because of its inefficiency.…That's something that can come up in an interview question…regarding algorithms where they propose some type…of linear search, but really you want to try to think of…the most efficient approach.…
- 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.