Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions search/binary_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static void test1() {
uint64_t derived_ans = search::binary_search::binarySearch(arr, 4);
std::cout << "Test #1: ";
assert(derived_ans == expected_ans);
std::cout << "Passed!" << std::endl;
std::cout << "Binary search test passed!" << std::endl;
}

/*******************************************************************************
Expand All @@ -117,7 +117,7 @@ void test2() {
uint64_t derived_ans = search::binary_search::binarySearch(arr, 25);
std::cout << "Test #2: ";
assert(derived_ans == expected_ans);
std::cout << "Passed!" << std::endl;
std::cout << "Binary search test passed!" << std::endl;
}

/*******************************************************************************
Expand All @@ -134,7 +134,7 @@ void test3() {
uint64_t derived_ans = search::binary_search::binarySearch(arr, 31);
std::cout << "Test #3: ";
assert(derived_ans == expected_ans);
std::cout << "Passed!" << std::endl;
std::cout << "Binary search test passed!" << std::endl;
}

/*******************************************************************************
Expand Down
6 changes: 5 additions & 1 deletion search/jump_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ int main() {
int index = jumpSearch(arr, x, n);

// Print the index where 'x' is located
std::cout << "\nNumber " << x << " is at index " << index;
if (index != -1) {
std::cout << "\nNumber " << x << " found at index " << index << std::endl;
} else {
std::cout << "\nNumber not found in array" << std::endl;
}
return 0;
}
2 changes: 1 addition & 1 deletion search/linear_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static void tests() {
assert(LinearSearch(array, size, 1) == 1);
assert(LinearSearch(array, size, 5) == 5);

std::cout << "All tests have successfully passed!\n";
std::cout << "All linear search tests passed successfully!\n";
delete[] array; // free memory up
}

Expand Down