0% found this document useful (0 votes)
6 views1 page

Sequential Search1

Sequential search, or linear search, is a basic algorithm that finds an element in a list by checking each element one by one. It has a best-case time complexity of O(1) and a worst-case time complexity of O(n), as it may need to check all elements. If the target element is not found, the algorithm returns a message indicating its absence in the list.

Uploaded by

Saritha Dev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Sequential Search1

Sequential search, or linear search, is a basic algorithm that finds an element in a list by checking each element one by one. It has a best-case time complexity of O(1) and a worst-case time complexity of O(n), as it may need to check all elements. If the target element is not found, the algorithm returns a message indicating its absence in the list.

Uploaded by

Saritha Dev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Sequential search, also known as linear search, is a simple searching algorithm used to find an element

in a list or array.

It works by checking each element in the list one by one until the target element is found or the entire
list has been searched.

How It Works:

Start from the first element of the list.

Compare the current element with the target element.

If they match, return the index of the element.

If they don’t match, move to the next element.

Repeat the process until the element is found or the list ends.

If the element is not found, return a message indicating it is not in the list.

Time Complexity:

Best case: O(1)O(1)O(1) (if the target is the first element)

Worst case: O(n)O(n)O(n) (if the target is at the end or not in the list)

Average case: O(n)O(n)O(n) (since we may have to check half of the elements on average)

You might also like