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 am thinking out aloud, so please feel free to correct me. :)
I have two questions based on particular scenarios:
Assume we have a very large tree(say a billion leaves, or more) and a very large input string, will we not be traversing the tree from the root to leaf during every iteration(especially assuming the code of every leaf is present in the input string)?
If the input string contains codes for every leaf in the tree repeated "N" times, traversal from the root to a particular leaf would increase by a factor of N. Would this not be inefficient(especially considering 1)?
I am not sure how realistic these scenarios are but worth thinking about.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Huffman Decoding
You are viewing a single comment's thread. Return to all comments →
I am thinking out aloud, so please feel free to correct me. :)
I have two questions based on particular scenarios:
Assume we have a very large tree(say a billion leaves, or more) and a very large input string, will we not be traversing the tree from the root to leaf during every iteration(especially assuming the code of every leaf is present in the input string)?
If the input string contains codes for every leaf in the tree repeated "N" times, traversal from the root to a particular leaf would increase by a factor of N. Would this not be inefficient(especially considering 1)?
I am not sure how realistic these scenarios are but worth thinking about.