mirror of
https://github.com/huihut/interview.git
synced 2024-03-22 13:10:48 +08:00
7 lines
141 B
C
7 lines
141 B
C
// 顺序查找
|
|
int SequentialSearch(vector<int>& v, int k) {
|
|
for (int i = 0; i < v.size(); ++i)
|
|
if (v[i] == k)
|
|
return i;
|
|
return -1;
|
|
} |