✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
Given the algorithm below and an input A=[1,6,2,7,5,8,4,3]A=[1,6,2,7,5,8,4,3], determine the return when the input value xx is 5.
procedure Alg2(x, A): A is a list of n integers
1 i = 0
2 while (i < n)
3 if (x == A[i])
4 break
5 end of if
6 i = i + 1
7 end of while
8 if (i < n)
9 location = i
a else:
b location = -1
c end of if
d return location
Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!