Skip to content

Commit b2d461b

Browse files
committed
Translated LinearSearch Algorithm in cpp
1 parent 8b245e8 commit b2d461b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/cpp/BuscaSequencial.cpp renamed to src/cpp/LinearSearch.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using namespace std;
55

6-
int busca_sequencial(vector<int> &nums, int target) {
6+
int linear_search(vector<int> &nums, int target) {
77

88
for (size_t i = 0; i < nums.size(); i++) {
99

@@ -19,17 +19,17 @@ int main() {
1919
vector<int> nums = {1, 2, 3, 4, 5, 27, -1, 12, 999};
2020
int target;
2121

22-
cout << "Digite o numero que deseja buscar no vetor: ";
22+
cout << "Enter the number you would like to search in the vector: ";
2323
cin >> target;
2424
cout << "\n";
2525

26-
int pos = busca_sequencial(nums, target);
26+
int pos = linear_search(nums, target);
2727

2828
if(pos > -1) {
29-
cout << "Numero encontrado no vetor na posicao: " << pos << endl;
29+
cout << "Number found in the vector in the position: " << pos << endl;
3030
}
3131
else {
32-
cout << "Numero nao encontrado no vetor." << endl;
32+
cout << "Number not found in the vector." << endl;
3333
}
3434

3535
return 0;

0 commit comments

Comments
 (0)