
Linear Search
Presentation
•
Computers
•
9th - 10th Grade
•
Practice Problem
•
Medium
Chris CHA
Used 5+ times
FREE Resource
3 Slides • 7 Questions
1
Linear Search
2
Linear Search Algorithm
sports = ["soccer", "hockey", "basketball", "archery"]
When data is unsorted, the sensible option when searching for a particular item is to start at the beginning and look at every item until you find the one you want. You could be lucky and find it quickly if it's near the front of the list or you may need to wait if it's near the back.
This is a LINEAR SEARCH.
3
Study this code and answer the questions on the next few slides.
Linear Search
4
Multiple Choice
What is the best description for what happens to found and index in this snippet?
They are initialised
They are evaluated
They are discarded
They are mutated
5
Multiple Choice
What is the best description of the control structures in this code snippet?
An iteration with another iteration nested inside.
A sequence of selections and a nested iteration.
An iteration with two selections inside
A selection with two iterations nested inside
6
Multiple Select
What happens to the index variable on each iteration of the REPEAT...UNTIL loop?
It's value does not change
It is used to determine which element of the list is examined
It is used to determine if there are no more elements left in the list to examine
It is increased by 1 on each iteration
7
Multiple Choice
list = ["Tim", "Kate", "Ali", "Gayle"]
If target is "Gayle", what would be the value of index when found is assigned the value True?
4
3
2
1
8
Multiple Choice
What is the best description for this selection block?
Compares index to list length to see if the loop has reached the end of the list. It will exit the loop using BREAK
Compares index to target to see if the loop has become less than the length of the list. It will BREAK from looping until the target is found.
Compares index to list length then BREAKs into another iteration and selection until the target is found.
Compares index to list length and then BREAKS the processor in half demanding that target is found.
9
Multiple Choice
What is the best description for this selection block?
If the list item at the current index is the same as the target it BREAKS out of the loop
If the list item at the current index is not the same as the target it BREAKS out of the loop and sets found to False
If the list item at the current index is the same as the target it BREAKS out of the loop and sets found to True
If the list item at the current index is the same as the target it sets found to True and then BREAKS out of the loop
10
Multiple Choice
list = ["Jim", "Barolo", "Guiseppe", "Arlan"]
If target was Barolo, what would the output be?
Target not found in the list
Target found at index index
Target found at index 0
Target found at index 1
Linear Search
Show answer
Auto Play
Slide 1 / 10
SLIDE
Similar Resources on Wayground
8 questions
Intellectual Property
Presentation
•
9th Grade
10 questions
Slope given a Graph
Presentation
•
9th Grade
6 questions
MAC 2 | Lesson 5-7 | Wrap it Up
Presentation
•
KG
8 questions
PSEDUCODE
Presentation
•
10th Grade
7 questions
11.6 Two Way Frequency Tables
Presentation
•
9th Grade
10 questions
Parallel Structure
Presentation
•
9th - 10th Grade
7 questions
ICT 10 3RD QUARTER REVIEW
Presentation
•
10th Grade
7 questions
TLE 10
Presentation
•
10th Grade
Popular Resources on Wayground
24 questions
PBIS-HGMS Day 10
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Review 3
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
15 questions
HCS SCI 05 Summer School Assessment 3 Review
Quiz
•
5th Grade
35 questions
Lufkin Road Middle School Student Handbook & Policies Assessment
Quiz
•
7th Grade
18 questions
Geo 11.3 Area of Circles and Sectors
Quiz
•
9th - 11th Grade