Characteristic
•
Time Complexity:
•
Space Complexity:
•
Worst Search Method
Sample Code
def linear_search(list, target):
for i in range(0, len(list)):
if list[i] == target:
return i
return None
def verify(index):
if index is not None:
print(f"Target found at index: {index}")
else:
print("Target not found in list")
verify(linear_search([1,2,3,4,5,6,7,8,9,10],5))
Python
복사



