(Docs)Updated Linear-Search.md
I noticed the steps in the algorithm to be continuous which would make it inconvenient for the reader. So, I reformatted the steps to look much cleaner and readable.pull/1096/head
parent
e60d299077
commit
aba1357a9c
|
@ -10,13 +10,20 @@ Linear search is usually very **simple to implement**.
|
|||
## Steps/Algorithm:
|
||||
**Linear Search( Array A, Value x)**
|
||||
|
||||
Step 1: Set i to 1
|
||||
Step 2: if i > n then go to step 7
|
||||
Step 3: if A[i] = x then go to step 6
|
||||
Step 4: Set i to i + 1
|
||||
Step 5: Go to Step 2
|
||||
Step 6: Print Element x Found at index i and go to step 8
|
||||
Step 7: Print element not found
|
||||
Step 1: Set i to 1
|
||||
|
||||
Step 2: if i > n then go to step 7
|
||||
|
||||
Step 3: if A[i] = x then go to step 6
|
||||
|
||||
Step 4: Set i to i + 1
|
||||
|
||||
Step 5: Go to Step 2
|
||||
|
||||
Step 6: Print Element x Found at index i and go to step 8
|
||||
|
||||
Step 7: Print element not found
|
||||
|
||||
Step 8: Exit
|
||||
|
||||
## Pseudocode
|
||||
|
|
Loading…
Reference in New Issue