What is Nostr?
mei /
npub1mx5…gnxv
2024-12-26 09:51:34
in reply to nevent1q…uawy

mei on Nostr: nprofile1q…qrcc0 I took a look at your index_slow_and_bad, and I think that the ...

nprofile1qy2hwumn8ghj7un9d3shjtnddaehgu3wwp6kyqpqdhnn6acp8d933rcmkrw8vceqfhyfr26jw4a9katmwqhqelwkc50swqrcc0 (nprofile…rcc0) I took a look at your index_slow_and_bad, and I think that the reason it’s slow is that you’re iterating over the whole reindeers set in each iteration of the loop. this means that choosing the best reindeer takes O(n) time, and the whole algorithm takes O(n²) time.

to make A* actually be fast, you need a better data structure for this – a priority queue

these are usually implemented as a heap. let me know if you’d like me to explain further!
Author Public Key
npub1mx50e9vuyx0eytmncz2mvv68kgc6402qypkm22uk9uk9x7u6vl3symgnxv