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

Method LinearSearch

Arrays/18_Menu_Based_problem.cpp:100–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98 *y=temp;
99}
100int Array::LinearSearch(int key)
101{
102 int i;
103 for(i=0;i<length;i++)
104 {
105 if(key==A[i])
106 {
107 swap(&A[i],&A[0]);
108 return i;
109 }
110 }
111 return -1;
112}
113int Array::BinarySearch(int key)
114{
115 int l,mid,h;

Callers 1

mainFunction · 0.80

Calls 1

swapFunction · 0.70

Tested by

no test coverage detected