Search code examples
algorithmarchitecturelanguage-agnosticsystem

Implementing an operation without operators


There are many interview questions like

implement addition without using +,-,*,/

My question isn't about how to do one of these but rather: what is the practical use of those questions?

Are there systems which do not support addition? Or is there another particular circumstance I should be aware of?


Solution

  • The only practical use I can see is if the company designs circuits or microcode for adders. While it is useful from a theoretical perspective to know how addition is performed on binary numbers, software developers are more concerned about operator precedence (addition after multiplication after exponentiation after parentheses, etc.)

    Maybe it is useful to see if the programmer knows how bit operators work but if the language supports addition then there is no need to reinvent the wheel.

    For most software development jobs out there, I would say this question has no practical use. Finding a good fit with the toolset and culture is way more important.