You are on page 1of 4

Assignment# 5

SUBJECT: Fundamentals Of Programming

SUBMITTED TO: Mr. Sameed ur Rehman

Name: Muhammad Idrees


Program: Computer Science
Section: CC
Id: 15365

Date of Submission: 11/2/2024


LINEAR SEARCH
Linear search is a simple searching algorithm that sequentially checks each
element of a given list or array to see if it matches a target value. It starts from
the beginning of the list and compares each element one by one until either the
target value is found or the entire list has been traversed. If the target value is
found, the search is considered successful, otherwise, it is considered
unsuccessful.

PROCESS OF LINEAR SEARCH


The process of linear search can be summarized as follows:
1. Iterate through each element in the list/array.
2. Compare the current element with the target value.
3. If the current element matches the target value, return the index of the
element.
4. If the entire list has been traversed and the target value is not found, return a
value to indicate the search was unsuccessful.

SYNTAX:
<data_type> <func_name>(<data_type> <array_name>[size])
PROGRAM:
Input:
Ouput:

You might also like