+ 1

Reduce my time complexity

I have an arena 1Mx1M There are units on it and a base I have to know the shortest path from a unit to the base I using BFS algorithm and it work well but if the base is on (100 000, 100 000) It takes about 15 mins to set the road How can i fix that ??

5th Dec 2020, 2:00 PM
Michel Ghaith
Michel Ghaith - avatar
1 Odpowiedź
+ 3
try using dijsktras.. and also u can try a* algorithm by inserting the nearest units to a unit within a limited range while going from unit to base.
9th Dec 2020, 8:41 AM
Doggy
Doggy - avatar