Мегас 2003-08-21 19:11:04
Всего постов: 130
Бород: 100
Рейтинг: +5|16|-11 = -8%
public void dijkstra(Vertice v) {
Heap heap = new Heap();
heap.inserir( v, v, 0);
v.marcado = true;
while (! heap.estahVazio() ) {
Aresta a = heap.remover();
NoLista temp = vertices[a.destino].lista.inicio;
while( temp != null) {
if( !vertices[temp.destino].marcado ) {
vertices[temp.destino].marcado = true;
Aresta aresta = new Aresta(a.destino, temp.destino, temp.custo );
heap.inserir(aresta);
} else {
if ( vertices[temp.destino].menorCaminho > (vertices[a.destino].menorCaminho + temp.custo) ) {
vertices[temp.destino].menorCaminho = (vertices[a.destino].menorCaminho + temp.custo);
Aresta aresta2 = new Aresta(a.destino, temp.destino, temp.custo)
heap.inserir(aresta2);
}
}
temp = temp.prox;
} // fim do while temp
}// fim do heapvazio

Рвун Чехлов 2011-12-23 01:55:58 #
Янихуянипонел!!!
Обведите жыр овалом!

приколов.нет Байанометр СКОТОБАЗА АТАТАТ yaplakal.com
© СВАЛКА, 2003–2024. Авторы двиШка: megath[aka duro], skupr, спасибо MakZ'у за пинки ;), Methos'у за скин sandbox, Татьяне за синий скин, Сверстайго Сайтег за вебдванолизацию синего скина.
Также огромное спасибо всем, кто сюда что-то когда-то постил, и тем, кто постил тем, кто постил, а также - авторам )))