Skip to content

Instantly share code, notes, and snippets.

@marvinferreira
Last active March 11, 2017 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marvinferreira/51925aa831b82dc92d2be2a836e745d1 to your computer and use it in GitHub Desktop.
Save marvinferreira/51925aa831b82dc92d2be2a836e745d1 to your computer and use it in GitHub Desktop.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
// ********** LEIA COM ATENÇÃO AS INSTRUÇÕES **********
//CRIAR UM PROJETO COM O NOME BUSCASEQUENCIALBINARIA_RAALUNO onde
//RAALUNO é o RA do proprietário do exercício!!
package buscasequencialbinaria_ra.aluno;
/**
* @author #NOME DO ALUNO COMPLETO#
*/
public class BuscaSequencialBinaria_RAALUNO {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO código de testes aqui.
int[] vetorBuscaSequencial = {10, 25, 75, 85, 1, -1, 61, 80};
int[] vetorBuscaBinariaIterativa = {1, 2, 30, 41, 73, 81, 90, 101};
int[] vetorBuscaBinariaRecursiva = {10, 25, 35, 40, 70, 80, 95, 101};
/*
- Implementar os 3 algoritmos contidos nos slides e utilizar os vetores acima
como massa de testes, há um vetor para cada exercício.
- Fazer duas chamadas para cada método, uma em que encontra a posição do elemento e
outra em que o elemento buscado não está presenta na lista.
- Printar a resposta de todas as chamadas aos métodos.
*/
}
public static int BuscaSequencial(int[] vetor, int valorBuscado){
//Implementar a busca sequencial sem otimização
return -1;
}
public static int BuscaBinariaIterativa(int[] vetor, int valorBuscado){
//Implementar a busca binária ITERATIVA
return -1;
}
public static int BuscaBinariaRecursiva(int[] vetor, int valorBuscado, int esq, int dir){
//Implementar a busca binária RECURSIVA
return -1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment