MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / LinearSearch

Function LinearSearch

Arrays/31_Menu_for_Array.c:125–141  ·  view source on GitHub ↗

LinearSearch Normal Method Funtion

Source from the content-addressed store, hash-verified

123
124//LinearSearch Normal Method Funtion
125void 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
144void LinearSearchSwapToPrev(struct array *arr,int key)

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected