LinearSearch Normal Method Funtion
| 123 | |
| 124 | //LinearSearch Normal Method Funtion |
| 125 | void LinearSearch(struct array *arr,int key) |
| 126 | { |
| 127 | int i,x=0; |
| 128 | for(i=0;i<arr->length;i++) |
| 129 | { |
| 130 | if(arr->A[i]==key) |
| 131 | { |
| 132 | printf("The element is found at location %d\n",i); |
| 133 | x=1; |
| 134 | break; |
| 135 | } |
| 136 | } |
| 137 | if(!x) |
| 138 | { |
| 139 | printf("The element is not present in the array\n"); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | //LinearSearch Move to previous index Function |
| 144 | void LinearSearchSwapToPrev(struct array *arr,int key) |