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.
I suppose in practical terms a tree could only be useful if memory was concern. You'd have to calculate how much memory can a tree save you depending on various characteristics of data. It would seem that if tagnames are relatively long and tags are rather branchy, you could end up with an arbitrarily high memory overuse with the flat map, because a lot of your keys would be very long. Then again, you could try using hashed keys to get rid of that problem.
On than memory, tree could possibly have a very bad impact if this was some intense code, as I imagine it would lead to a lot of CPU cache misses.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Attribute Parser
You are viewing a single comment's thread. Return to all comments →
I suppose in practical terms a tree could only be useful if memory was concern. You'd have to calculate how much memory can a tree save you depending on various characteristics of data. It would seem that if tagnames are relatively long and tags are rather branchy, you could end up with an arbitrarily high memory overuse with the flat map, because a lot of your keys would be very long. Then again, you could try using hashed keys to get rid of that problem.
On than memory, tree could possibly have a very bad impact if this was some intense code, as I imagine it would lead to a lot of CPU cache misses.