Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     

Linear Search


searching starts from first element and ends till the element find out or list ends. E.g if we want to find the 4 number from 23553466 list then first 4 will be compare with the 2, not matched then next number 3. This process will continue till the 4 number not find out. in this loop it will make 6 comparison. At 6th position 4 will find out and loop will end

In linear search,


void main()
       int a[10],n,i,item,loc;
       printf("Enter the size of array: ");
       printf("\nEnter the elements of array:\n");
       printf("\nEnter the item tobe searched: ");

              printf("\nItem %d is not present in the array",item);
              printf("\nItem %d is present at %d location in the array",item,loc+1);

Share this article   |    Print    |    Article read by 1548 times
Rohit kakria
I am software developer, moderator of
Related Articles:
Related Interview Questions: No related interview question