Skip to content
This repository was archived by the owner on Jun 26, 2022. It is now read-only.

Done all changes #813

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,5 @@ If you have contributed to this repository, kindly add your username here
- [Pulkit Aggarwal](https://github.com/PulkitAgg)
- [dius00](https://github.com/dius00)
- [jayshah6699](https://github.com/jayshah6699)
- [Hardik Chitkara](https://github.com/hardikchitkara)

7 changes: 5 additions & 2 deletions Linear Search/vikhyatsingh123_linear_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ int search(int array[], int n, int x) {

// Going through array sequencially
for (int i = 0; i < n; i++)
{
if (array[i] == x)
return i;
{return i;}
}
return -1;

}

int main() {
Expand All @@ -19,5 +22,5 @@ int main() {

int result = search(array, n, x);

(result == -1) ? cout << "Element not found" : cout << "Element found at index: " << result;
(result == -1) ?cout << "Element not found" : cout << "Element found at index: " << result;
}