|
|
back to boardTLE Test 5 my algorithm is quite simple and i dont know how to make it fast. my hints would be appreciated. 1. i am using dfs to get the distance from vertex v to vertex u such that dist(v, u) = d given. 2. while computing the vertex u..i am saving the result of all previous vertices u1, u2, ....ud..such that distance between v and u1 is 1, v and u2 is 2 and so on. i am saving the result in hashmap. 3. i only use dfs if the hashmap doesnt contain the query. I can email my code as well.... Thanks |
|
|