1

I have a very large string (around 1000 characters) and its represented in base B.

Whats the best way to convert it to binary representation since I can't use any arithmetic operators.

This is an interview practice question and I just want to clear up my basics about bit manipulation.

Charles
  • 50,943
  • 13
  • 104
  • 142
Pranava Sheoran
  • 529
  • 4
  • 27
  • 1
    When you know the procedure to convert from base 10 to base 2 (binary base), then use the very same procedure to convert from any base to binary base. – RAM Oct 30 '12 at 09:35
  • yes i know the procedure, but i am just wondering if there is a more efficient way to do this conversion. For such a large string , each I'll have to iterate through each character and divide them by 2 for each division. Thus the complexity would be around n*logN where n is the length of the string and N is the number being represented – Pranava Sheoran Oct 30 '12 at 09:36

0 Answers0