Sunday, 19 December 2010

Flow chart To perform the linear search operation

Description:

The linear search is most simple searching method. It does not expect the list to be sorted. The key which is to be searched is compared with each element of the list one by one. If a match exists, the search is terminated. If the end of list is reached it means that the search has failed and key has no matching in the list.


Output:

enter range for array:4 enter elements into array:56 43 12 88 9
enter the search element:9
element 9 found at 4

enter range for array:5 enter elements into array:23 12 56 34 3 8
enter the search element:3
element 3 found at 4

conclusion: the program is error free

VIVA QUESTIONS:

1) Define linear search ?
Ans : The linear search is most simple searching method. It does not expect the list to be sorted. The key which is to be searched is compared with each element of the list one by one. If a match exists, the search is terminated. If the end of list is reached it means that the search has failed and key has no matching in the list.


Programming Videos:

Data structures using Java

No comments:

Post a Comment