Question: Write an efficient C++ function that takes any integer value i and returns 2 i , as a long value. Your function should not multiply
Write an efficient C++ function that takes any integer value i and returns 2i, as a long value. Your function should not multiply 2 by itself i times; there are much faster ways of computing 2i.
Step by Step Solution
3.54 Rating (175 Votes )
There are 3 Steps involved in it
Explanation For faster calculation we can use bit manipulation The Le... View full answer
Get step-by-step solutions from verified subject matter experts
