Saturday, 14 September 2013

What is the best runtime complexity and spatial complexity of the 3 page sequence in a weblog exercise?

What is the best runtime complexity and spatial complexity of the 3 page
sequence in a weblog exercise?

I got a solution in java that works in runtime complexity: O(n^2) and in
spatial complexity: O(n^2), I use a map <Integer, List<String>> to hold
the ids, and the visited urls-List, that why I said the spatial complexity
is O(n^2) and when I am iterating that map the runtime complexity is
O(n^2) to make the sequences. Can someone give me a better idea on how to
solve this exercise? this is similar to this exercise thanks

No comments:

Post a Comment