0% found this document useful (0 votes)
250 views1 page

Flowchart for Linear Search Algorithm

The document outlines an algorithm for performing a linear search in an array of strings, detailing steps for inputting strings and a target string, and checking for matches. It also describes how to represent this algorithm in a flowchart format. The process concludes with printing the result based on whether the target string was found in the array.

Uploaded by

valvi kuldip
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
250 views1 page

Flowchart for Linear Search Algorithm

The document outlines an algorithm for performing a linear search in an array of strings, detailing steps for inputting strings and a target string, and checking for matches. It also describes how to represent this algorithm in a flowchart format. The process concludes with printing the result based on whether the target string was found in the array.

Uploaded by

valvi kuldip
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Algorithm for Linear Search in Array of Strings

1. Start
2. Input Number of Strings (n)
3. Initialize Array of Strings with size n
4. Input Strings into the array
5. Input Target String
6. Initialize Index to -1
7. For Each String in Array:
o Compare the string with the target string
o If Strings Match:
 Set Index to the current position
 Break the loop
8. Check Index:
o If Index is -1: Print "Not Found"
o Else: Print "Found at Index"
9. End

Flowchart for Linear Search in Array of Strings

Here’s a description of how you might draw the flowchart:

1. Start
2. Input Number of Strings (n)
3. Initialize Array of Strings with size n
4. Input Strings into the array
5. Input Target String
6. Initialize Index to -1
7. For Each String in Array (i = 0 to n-1):
o Compare String[i] with Target String
o If Match:
 Set Index to i
 Break Loop
8. Is Index == -1?
o Yes: Print "Not Found"
o No: Print "Found at Index"
9. End

You might also like