Back to marketplace

2.1 Algorithms - Linear Search

No description yet. This curated deck is ready for daily study.

Total cards: 8•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (8)

#1
Front (Question)

What is a searching algorithm?

Back (Answer)

A searching algorithm is an algorithm that is used to search data in a list.

#2
Front (Question)

How does a linear search algorithm work?

Back (Answer)

The search begins with the first item and checks whether a match is found, then it moves to the second item, and so on. This search continues until a match is found or the end of the list is reached with no match found.

#3
Front (Question)

What is the pseudocode for a while loop in linear search algorithms?

Back (Answer)

while (position<len and list[position]!= item) position = position + 1 endwhile

#4
Front (Question)

What is the pseudocode for if…else… statement in a linear search algorithm?

Back (Answer)

if position> len then print (“item not found”) else print (“item found at position ” position) endif

#5
Front (Question)

Assume that there is a list of 7 elements. The search element is at position 4. How many times is the while loop executed?

Back (Answer)

5 times (value of position starts from 0)

#6
Front (Question)

Assume that there is a list of 7 elements. The search element is at position 4. How many times is the if…else… statement executed?

Back (Answer)

Only once

#7
Front (Question)

Assume that there is a list of 10 elements. The search element is not in list. How many times is the while loop executed?

Back (Answer)

10 times

#8
Front (Question)

Assume that there is a list of 10 elements. The search element is not in list. How many times is the if…else… statement executed?

Back (Answer)

Only once