Computer scienceAlgorithms and Data StructuresAlgorithmsArray algorithmsSearch algorithms

Searching problem

Messy store

Report a typo

Sequential search is a pretty common method used in real life as well. Think of a chaotic grocery store that is never out of milk, but has no signs, tables, or other guidance.

You need to buy milk to prepare hot chocolate after a long walk, so you have to find dairy products in the store. Order the steps below so that you can get your milk.

Put the items in the correct order
Start checking the shelves one by one, starting from the aisle closest to the entrance
Otherwise, move further from the door to the next aisle and repeat the same procedure
Get out of the store with the milk
If you see dairy products and milk, quit searching, milk is found
Enter the store
___

Create a free account to access the full topic