diff --git a/Arquivos/Pesquisa.c b/Arquivos/Pesquisa.c index 26e25dd597c1950d9ba1439aa9e3df1b7a3b6ac4..740af532b14effe574b3a3c71f5f514ebe37a6d6 100644 --- a/Arquivos/Pesquisa.c +++ b/Arquivos/Pesquisa.c @@ -20,6 +20,15 @@ int PesquisaBinaria (int *Vetor, int Elem) { return -1; //return = -1 pq o se o elemento estiver na primeira posição irá retornar 0 (posição que ele se encontra no vetor) } +int PesquisaSequencial(int *Vetor, int Elem) { + int i; + Vetor[0] = Elem; + for (i=TAM-1; i>=0; i++) { + if (Vetor[i] == Elem) + return i; + } +} + void VerificaNumero (int *Vetor, int *Escolhidos) { int i, acertos;