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

Function RevBinSearch

Arrays/31_Menu_for_Array.c:214–239  ·  view source on GitHub ↗

Binary Search Recursion method Function

Source from the content-addressed store, hash-verified

212
213//Binary Search Recursion method Function
214void RevBinSearch(struct array arr,int low,int high,int key)
215{
216 int mid,x=0;
217 if(low<=high)
218 {
219 mid=(low+high)/2;
220 if(arr.A[mid]==key)
221 {
222 printf("The element is found at location %d\n",mid);
223 x=1;
224 }
225 else if(key<arr.A[mid])
226 {
227 RevBinSearch(arr,low,mid-1,key);
228 }
229 else if(key>arr.A[mid])
230 {
231 RevBinSearch(arr,mid+1,high,key);
232 }
233 }
234 else
235 {
236 printf("The element is not found\n");
237 }
238
239}
240
241//Get Function
242void Get(struct array arr,int index)

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected