Linear Search (OCR A-Level Computer Science): Flashcards

📚Flashcards
Linear Search
Sign up to keep revising.Create a free account to study more flashcards and track your progress.

Practise the cards

12 cards from this deck

Show

What is Linear Search?

Algorithm to find position of target value in a list by checking elements sequentially

How does Linear Search work?

Sequentially checks each element until found or end reached

Linear Search works on what types of data?

Both sorted and unsorted datasets

Linear Search best case time complexity

O(1)O(1) when target is first element

Linear Search worst case time complexity

O(n)O(n) when target is last or not present

Linear Search average case (simplified)

O(n)O(n)

Linear Search space complexity

O(1)O(1), no extra memory required

Common return value when target not found

-1

Linear Search return on match found

Index or position of the element

Linear Search main advantage

Simple and easy to implement

Linear Search main disadvantage

Inefficient for large datasets

Common mistake: return vs print

Using print instead of return in function

Explore OCR A-Level Computer Science Revision Notes by Topics

Explore OCR A-Level Computer Science Model Answers by Topics

Explore OCR A-Level Computer Science Quizzes by Topics

Explore OCR A-Level Computer Science Exam Questions by Topics

Join 100,000+ A-Level students studying Flashcards with us.

Select your subjects, and get access to A+ resources today.