Overhaul pathfinding algorithm
This commit is contained in:
@@ -29,6 +29,25 @@ int main() {
|
||||
printf("%d\n", node.weight);
|
||||
}
|
||||
|
||||
printf("\n\n");
|
||||
bzHeapDestroy(heap);
|
||||
|
||||
heap = bzHeapCreate(Node, 10);
|
||||
bzHeapPush(heap, (Node) {3});
|
||||
bzHeapPush(heap, (Node) {8});
|
||||
bzHeapPush(heap, (Node) {10});
|
||||
bzHeapPush(heap, (Node) {5});
|
||||
bzHeapPush(heap, (Node) {12});
|
||||
bzHeapPush(heap, (Node) {7});
|
||||
|
||||
heap[3].weight = 20;
|
||||
bzHeapUpdate(heap, 3);
|
||||
|
||||
while (!bzHeapIsEmpty(heap)) {
|
||||
Node node = bzHeapPop(heap);
|
||||
printf("%d ", node.weight);
|
||||
}
|
||||
|
||||
bzHeapDestroy(heap);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user