Question: The following program segment is supposed to search an array A consisting of N elements for a value Key and set Found equal to 1
The following program segment is supposed to search an array A consisting of N elements for a value Key and set Found equal to 1 or 0, depending on whether Key is located. It contains two errors. Correct them. Assume that the array A and the other variables have already been properly declared.
![Set Index = 0 %3! Set Found = 0 While (Found If A[Index] == Key Then 1) AND (Index < N) Set Found = 0 %3D Set Index = Index + 1 End If End While](https://dsd5zvtm8ll6.cloudfront.net/si.question.images/images/question_images/1608/2/0/3/8615fdb3e557170b1608203860531.jpg)
Set Index = 0 %3! Set Found = 0 While (Found If A[Index] == Key Then 1) AND (Index < N) Set Found = 0 %3D Set Index = Index + 1 End If End While
Step by Step Solution
3.48 Rating (155 Votes )
There are 3 Steps involved in it
Correct the Whilestatement a... View full answer
Get step-by-step solutions from verified subject matter experts
