We have to multiply two numbers x and y but we cannot use * operator.
One simple way is to add x , y times OR add y, x times which is simple enough and is linear.
Second way is to pick any number(say x) and see which all bits are set in that number and if ith bit is set just do this:
product +=y<<i//product is 0 initially and do this for all i.
clearly for 32 bit numbers the loop runs 32 times and its time complexity is constant.
My question is , Is there any other way?Remember we cannot use *.