Linear Search (OCR A-Level Computer Science): Flashcards
📚Flashcards
Practise the cards
12 cards from this deck
ShowHide
Practise the cards
12 cards from this deck
What is Linear Search?
What is Linear Search?
Algorithm to find position of target value in a list by checking elements sequentially
How does Linear Search work?
How does Linear Search work?
Sequentially checks each element until found or end reached
Linear Search works on what types of data?
Linear Search works on what types of data?
Both sorted and unsorted datasets
Linear Search best case time complexity
Linear Search best case time complexity
when target is first element
Linear Search worst case time complexity
Linear Search worst case time complexity
when target is last or not present
Linear Search average case (simplified)
Linear Search average case (simplified)
Linear Search space complexity
Linear Search space complexity
, no extra memory required
Common return value when target not found
Common return value when target not found
-1
Linear Search return on match found
Linear Search return on match found
Index or position of the element
Linear Search main advantage
Linear Search main advantage
Simple and easy to implement
Linear Search main disadvantage
Linear Search main disadvantage
Inefficient for large datasets
Common mistake: return vs print
Common mistake: return vs print
Using print instead of return in function
