C Program for Linear SearchLinear Search is a sequential searching algorithm in C that is used to find an element in a list. Linear Search compares each element of the list with the key till the element is found or we reach the end of the list.ExampleInput: arr = {10, 50, 30, 70, 80, 60, 20, 90, 40}, key: 30Output: Key Found
4 min read
Linear Search - PythonGiven an array, arr of n elements, and an element x, find whether element x is present in the array. Return the index of the first occurrence of x in the array, or -1 if it doesnât exist.Examples:Input: arr[] = [10, 50, 30, 70, 80, 20, 90, 40], x = 30Output : 2Explanation: For array [10, 50, 30, 70,
4 min read