Anthony has shared wonderful tips on interviewing at Google.
Interviewing at Google? Hereβs 6 Things You Absolutely Need To Do
Anthony D. Mays γ» Mar 23 '19
Within the fourth tip, Brainstorm solutions and their time/space complexity, Anthony stressed on "space-time tradeoff principle", which I was vaguely familiar with.
While attempting to understand it, I drew a sketchnote.
As it's not sharable, I came up with emoji version.
Space-time Tradeoff Table
β°π½π½πΌ | (faster + more space) | vs | β°πΌπ½π½ | (slower + less space) |
---|---|---|---|---|
ππ | (Lookup table) | ππ» | (Recalculation) | |
πΎ x 1 | (Uncompressed Data) | πΎ x 0.5 | (Compressed Data) | |
πͺπΌ | (Stored Image) | ππ | (Re-render) | |
βΏβ‘β° | (Loop Unrolling) | π¨βπ» x 0.5 | (Smaller code) |
Gist of each tradeoff
ππ(Lookup table) vs. ππ» (Recalculation)
Saving computed data in memory saves time but increases the space usage.πΎ x 1 (Uncompressed Data) vs. πΎ x 0.5 (Compressed Data)
Faster to access uncompressed data as no decompression step is needed but requires more space.πͺπΌ (Stored Image) vs. ππ (Re-render)
Storing image in cache is faster than re-rendering but requires more space (in disk/memory).βΏβ‘β° (Loop Unrolling) vs. π¨βπ» x 0.5 (Smaller code)
Loop unrolling can optimize execution speed at the cost of increased binary size.
It might be a bit too much of emojis but helped me to understand a bit better what tradeoffs are available.
Feel free to share your version of table or sketchnote π
Top comments (4)
This is great. Makes me want an entire CS textbook in emoji. Would make a great coffee table book.
Thanks @jeikabu .
You are getting somewhere with that coffee table book idea π
You are truly the emoji master! ?love those sketch notes too)
Just {...π} of Emojis π