Question: A programmer develops the procedure hasElevenEleven ( ) , which should return true if it ever finds a 1 next to a 1 somewhere. For

A programmer develops the procedure hasElevenEleven(), which should return true if it ever finds a 1 next to a 1 somewhere. For example, hasElevenEleven([7,1,1]) should return true, but hasElevenEleven([1,7,1]) should return false.
PROCEDURE hasElevenEleven(numbers){
i 1
REPEAT UNTIL (i =(LENGTH(numbers)-1)){
IF (numbers[i]=1 AND numbers[i +1]=1){
RETURN true
}
i i +1
}
RETURN false
}
The programmer tests it with hasElevenEleven([1,0,1,1,0]) and sees that it does indeed return true.
Can the programmer conclude that the procedure works correctly for all inputs?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!