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.
Not true, having the OS do output repeatedly is very time consuming unless its able to cache it, which is what a String Builder explicitly does. Print/output is not really a constant time operation, so while you think you save space but not having a string, you are in fact calling a method which blocks until the OS handles it, which adds huge delays for each iteration.
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 →
Not true, having the OS do output repeatedly is very time consuming unless its able to cache it, which is what a String Builder explicitly does. Print/output is not really a constant time operation, so while you think you save space but not having a string, you are in fact calling a method which blocks until the OS handles it, which adds huge delays for each iteration.