DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Sung M. Kim
Sung M. Kim

Posted on

Space-time tradeoff Emoji Note

Anthony has shared wonderful tips on interviewing at Google.

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.

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

  1. πŸ™„πŸ“‘(Lookup table) vs. πŸ”ƒπŸ’» (Recalculation)
    Saving computed data in memory saves time but increases the space usage.

  2. πŸ’Ύ 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.

  3. πŸͺπŸ–Ό (Stored Image) vs. πŸ”ƒπŸ“œ (Re-render)
    Storing image in cache is faster than re-rendering but requires more space (in disk/memory).

  4. ➿➑➰ (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)

Collapse
 
jeikabu profile image
jeikabu

This is great. Makes me want an entire CS textbook in emoji. Would make a great coffee table book.

Collapse
 
dance2die profile image
Sung M. Kim

Thanks @jeikabu .
You are getting somewhere with that coffee table book idea πŸ™‚

Collapse
 
thejoezack profile image
Joe Zack

You are truly the emoji master! ?love those sketch notes too)

Collapse
 
dance2die profile image
Sung M. Kim

Just {...πŸ’–} of Emojis πŸ˜‰

DEV

Thank you.

Β 
Thanks for visiting DEV, we’ve worked really hard to cultivate this great community and would love to have you join us. If you’d like to create an account, you can sign up here.