Linear Search

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What are the steps of linear search?

1. Check if the current element is the item being searched for 2. If it isn't move to the next element in the array 3. Repeat the previous steps until the item is found or the entire array has been searched

Write the pseudocode for linear search

Check your VINs for answers

Describe the Linear Search Algorithm

Each item in an array is visited and checked against the search term. This is done until the item is found or the end of the array is reached

What are the advantages of the linear search?

Fast for small-medium arrays The array doesn't need to be sorted Easy to code

What are the disadvantages of the linear search?

It is slow for large lists

What are the complexities of Linear Search?

Time: Linear- O(n) Space: Constant O(1)

For what is Linear Search used?

When data cannot be sorted or when sorting takes too much time To search for real-time data (sensor readings) Finding strings in a text


Set pelajaran terkait

BA 314 Operations Management: Chapter 5: Constraint Management

View Set

Módulo 3: Representaciones simbólicas y algoritmos Dic. 2018

View Set

CH 3 Indicate whether the following items is real or nominal and whether it appears in the income statement or balance sheet.

View Set

AP Psych Unit 10: Personality (The Humanistic Perspective)

View Set

BIOE 105 Genetics Midterm 1 Review

View Set

MOST IMPORTANT Harry Potter Characters (Top 50)

View Set

Yoost questions for chapters 21 and 22

View Set

Organ Systems Overview exercise 2 REVIEW

View Set

Ch. 11: The Cardiovascular System

View Set

Chapter 5: Elasticity: A Measure of Responsiveness

View Set