c++ - What is the best single-source shortest path algorithm for programming contests? -
I was working with the UVA problem set This is a single-source-lowest-path problem, which has no negative edge. The best big-o-running algorithm for such problems, which I've gathered, is a biostat in the form of a priority queue with a physonic stack, although practically a binary pile is easy to speak and works very well is.
However, it appears that a binary pile also takes some time to roll, and is limited in the time of a competition. I know that STL provides some heap algorithms and priority queues but they do not provide low-key functions, which Dijkstra needs or am I wrong here?
It seems that there is another possibility that not only use bicuscamps. People have claimed that they have solved the above problem with the first discovery / Belman-Ford, which are very easy to code up (edit: Otoh, without the time of the dzkastra for the queue time Of any sort array). BFS / Belman-Ford surprised me a bit because I thought the size of the input was huge. I think different problems will require solutions to different complexities, but my question is how often do I have to use biennials in such competitions? Should I practice more on simple but slow algorithms instead? Based on my own experience, I implement the Dijkstra algorithm with a heap in a programming competition.
Was not required. You can take most of the time using a slow but efficient enough algorithm. You can use the best désztra implementation to solve a problem that expects a different / simple algorithm, but this case is rare.
Comments
Post a Comment