-
-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f505667
commit a13f49a
Showing
1 changed file
with
10 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Algorithm of Searching | ||
* Initialize an index variable to track the position where the value to search is found (set to an initial value, typically -1 to indicate not found). | ||
|
||
* Start looking through the data, comparing each element with the value to search. | ||
|
||
* If a match is found, update the index variable to the current position and stop searching. | ||
|
||
* Continue searching until the end of the data or until a match is found. | ||
|
||
* After the search, if the index remains at its initial value, it means the value to search was not found, so return a special value (e.g., -1) and taking this into consideration output an appropriate line for value not found. Otherwise, return the index where the search key was found. |