0
0
DSA C++programming~5 mins

Linear Search Algorithm in DSA C++ - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main idea behind the Linear Search Algorithm?
Linear Search checks each item in a list one by one until it finds the target or reaches the end.
Click to reveal answer
beginner
What is the time complexity of Linear Search in the worst case?
The worst-case time complexity is O(n), where n is the number of items in the list.
Click to reveal answer
beginner
Show the basic steps of Linear Search in simple terms.
1. Start at the first item.<br>2. Compare it with the target.<br>3. If it matches, stop and return the position.<br>4. If not, move to the next item.<br>5. Repeat until found or list ends.
Click to reveal answer
beginner
Why is Linear Search not efficient for large lists?
Because it checks every item one by one, it can take a long time if the list is big.
Click to reveal answer
beginner
In which cases is Linear Search useful?
When the list is small or unsorted, or when simplicity is more important than speed.
Click to reveal answer
What does Linear Search do first?
AChecks the first item in the list
BSorts the list
CDivides the list in half
DSkips to the middle item
What is the worst-case time complexity of Linear Search?
AO(1)
BO(log n)
CO(n log n)
DO(n)
When does Linear Search stop?
AAfter checking half the list
BWhen the target is found or list ends
CAfter sorting the list
DAfter checking the middle item
Which list type is Linear Search best suited for?
AUnsorted or small lists
BSorted lists
CVery large lists
DLists with duplicates only
What happens if the target is not in the list?
ALinear Search crashes
BLinear Search returns the last item
CLinear Search returns -1 or not found
DLinear Search sorts the list
Explain how Linear Search works step-by-step.
Think about checking items one by one.
You got /4 concepts.
    Describe when and why you would use Linear Search instead of other search methods.
    Consider list size and order.
    You got /4 concepts.