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!
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!