Download the Guru IA app

Android and iOS

Foto de perfil

Michel

Linguagens de Programação05/22/2024

Observe o código abaixo escrito na linguagem C. 1 finclude <...

Observe o código abaixo escrito na linguagem C. 1 finclude <stdio.h> 2 tdefine TAMIO 3 int funcaol(int vetor[], int v)( 4 int i; 5 for (i = O; i < TAM; i++)( 6 if (vetor[i] == v) 7 return i; 8 , 9 return -1; 10 ) 11 int funcao2(int vetor[], int v, int i, int Oi 12 intm=(i+f)/2; 13 if (v = vetor[nm]) 14 return m; 15 if (ic-f 16 return 1; 17 if (v > vetor[m]) 18 return funcao2 (vetor, v, mil, £); 19 else 20 return funcao2 (vetor, v, i, m-1); 2) 22 âintmainOl 23 int vetor[TAM] = (1, 3, 5, 7, 9, 11, 13, 15, 17, 19); 24 printf(“&d - $d”, funcaol (vetor, 15), funcao2(vetor, 15, 0, TAM-1)); 25 return 0; 26) A respeito das funções implementadas, avalie as afirmações a seguir. |. Oresultado da impressão na linha 24 é: 7 - 7. Il. Afunção funcao, no pior caso, é uma estratégia mais rápida do que a funcao2. Il. A função funcao? implementa uma estratégia iterativa na concepção do algoritmo. É correto o que se afirma em

Send your questions through the App
Equipe Meu Guru

Do you prefer an expert tutor to solve your activity?

  • Receive your completed work by the deadline
  • Chat with the tutor.
  • 7-day error guarantee