This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.ufpb.dcx.aps; | |
import java.io.BufferedInputStream; | |
import java.net.URL; | |
import java.util.Properties; | |
public class ConexaoBD { | |
private static ConexaoBD[] instances = null; | |
private static Integer qtdConexoes = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Representa uma árvore formada por nós com, no máximo, dois filhos. | |
* Possui apenas a referência para a raiz, de onde partem todos as | |
* buscas. | |
* | |
* As árvores de busca binária têm uma propriedade em todos os nós: | |
* os valores menores ficam na sub-árvore à esquerda e os valores | |
* maiores ficam na sub-árvore à direita. | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Representa uma árvore formada por nós com, no máximo, dois filhos. | |
* Possui apenas a referência para a raiz, de onde partem todos as | |
* buscas. | |
* | |
* As árvores de busca binária têm uma propriedade em todos os nós: | |
* os valores menores ficam na sub-árvore à esquerda e os valores | |
* maiores ficam na sub-árvore à direita. | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TabelaHash { | |
private Registro[] registros = new Registro[10]; | |
public void put(Object chave, String valor) { | |
int posicao = hash(chave); | |
//Se ainda não existem registros nesta linha do hash | |
if (registros[posicao] == null) { | |
registros[posicao] = novoRegistro(chave, valor); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Cliente { | |
private long cpf; | |
private long cnpj; | |
private String nome; | |
private String slogan; | |
public String getNome() { | |
return nome; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.Assert.*; | |
import org.junit.Test; | |
public class DijkistraTest { | |
@Test | |
public void testDistancia() { | |
GrafoComListaDeAdjacencias grafo = | |
new GrafoComListaDeAdjacencias("JP", "MA", "AL", "GU", "CG", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.Queue; | |
public class GrafoComListaDeAdjacencias implements Grafo { | |
private List<Vertice> vertices = new ArrayList<>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Aresta { | |
private Vertice origem; | |
private Vertice destino; | |
private int distancia; | |
public Vertice getOrigem() { | |
return origem; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Aresta { | |
private Vertice origem; | |
private Vertice destino; | |
private int distancia; | |
public Vertice getOrigem() { | |
return origem; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ListaNetflix { | |
private Node inicio; | |
public void add(Object x) { | |
Node novo = new Node(); | |
novo.setValor(x); | |
if (inicio == null) { |
NewerOlder