LAB2 - Python
LAB2 - Python
Experiment # 2
Recursive and Iterative Linear Search Lab Instructor: Eng Kamal Al-homidi
Objectives:
• Implement Recursive and Iterative Linear Search.
• Determine the complexity of the algorithms.
• Repeat the experiment for different values of n, the number of elements in the list to be
searched.
OutPut:
IterLinearSearch(A, n, key)
// A – Array of elements
// n – size of an array
// key – element to be searched
for i = 1 to n
if A[i] = key then return i
else return -1