Let's get started with the most basic of searching algorithms, the linear search. It basically involves searching a particular element in a linear array of elements by looking at each of its indices.
Let us suppose an array of integers A contain elements 1,3,4,6,2 and the element to be searched be 4. This is done by looking at each index of A ie. A[0], A[1],..,A[n] and checking if the value contained is equal to the search element 6. Here, n is the number of elements in the array.
Let us suppose an array of integers A contain elements 1,3,4,6,2 and the element to be searched be 4. This is done by looking at each index of A ie. A[0], A[1],..,A[n] and checking if the value contained is equal to the search element 6. Here, n is the number of elements in the array.