We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
But since this is a dense graph(complete graph infact), E=n(n-1)/2 (nc2) and V=n^2 which makes dijkstra even slower whereas ur algo runs in exact O(n^2)....XD
Project Euler #81: Path sum: two ways
You are viewing a single comment's thread. Return to all comments →
what u did IS THE most optimal algo..
using dijkstra's here is stupid coz it's
1.O(E+Vlog(V))..(using fibo heap)
2.O((E+V)log(V))..(using binary heap)
But since this is a dense graph(complete graph infact), E=n(n-1)/2 (nc2) and V=n^2 which makes dijkstra even slower whereas ur algo runs in exact O(n^2)....XD