Multiplying two binary numbers takes n^2 time, yet squaring a number can be done more efficiently somehow. (with n being the number of bits) How could that be?
Or is i
I would want to solve the problem by N bit multiplication for a number
A the bits be A(n-1)A(n-2)........A(1)A(0).
B the bits be B(n-1)B(n-2)........B(1)B(0).
for the square of number A the unique multiplication bits generated will be for A(0)->A(0)....A(n-1) A(1)->A(1)....A(n-1) and so on so the total operations will be
OP = n + n-1 + n-2 ....... + 1 Therefore OP = n^2+n/2; so the Asymptotic notation will be O(n^2)
and for multiplication of A and B n^2 unique multiplications will be generated so the Asymptotic notation will be O(n^2)