Question
If you prefer using base 10 for the Int() class (its much easier to convert these to and from strings, for example), you may consider
If you prefer using base 10 for the Int() class (its much easier to convert these to and from strings, for example), you may consider using base 1 billion. A number in this base can be written as
an 1000000000n + an1 1000000000n1 + . . . + a1 10000000001 + a0 10000000000
where each ai is an integer between 0 and 999999999. The array (or list) of ints which hold the digits can store a number in this range. The size of this data structure will clearly be much smaller. Conversion between base 1 billion and base 10 is easy because 1 billion = 109 . You may also consider using an array (or list) of type long, using as your base the maximum power of 10 which does not exceed the maximum positive long value 263 1.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started