
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
7 questions
JAVA
Presentation
•
9th - 10th Grade
8 questions
Polyhedrons and Nets Review
Presentation
•
9th - 10th Grade
8 questions
Digitális platformok online workshop
Presentation
•
KG
10 questions
Point of View
Presentation
•
9th - 10th Grade
9 questions
Equations of Circles
Presentation
•
9th - 10th Grade
8 questions
Solving Equations by Combining Like Terms
Presentation
•
9th Grade
7 questions
11.8 Correlation vs. Causation
Presentation
•
9th Grade
9 questions
Limiting Reactant and Percent Yield
Presentation
•
10th Grade
Popular Resources on Wayground
6 questions
PRIDE Always and Everywhere
Presentation
•
12th Grade
20 questions
Lab Safety Quiz
Quiz
•
6th Grade
26 questions
KOR Review Kahoot Questions
Quiz
•
8th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
12 questions
Unit Zero lesson 2 cafeteria
Presentation
•
9th - 12th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
10 questions
Riddles Riddles fun Riddles
Quiz
•
6th - 12th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade