How you will print the 100th power of a single digit( which is of type
int). How do you maintain that big number in memory?
Lets C The Approach
Thank Regards
Shashank
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
Try this...
#include iostream
#include cmath
using namespace std;
#define DIGITS 10001
void mult(int N,int pro[],int len) {
int carry = 0;
for(int i=0;ilen;i++) {
int temp = pro[i]*N + carry;
pro[i] = temp%10;
carry = temp/10;
}
if(carry0) {
pro[len] =
You can do it in (log n) assuming multiplication is O(1)
suppose u are going to calculate 8 power 33
u compute 8 power 16 and multiply with the same to get 8 power 32
then multiply with 8 to get the result
On Thu, Mar 24, 2011 at 1:04 PM, AAMIR KHAN ak4u2...@gmail.com wrote:
Try this...
Yeah i know the algorithm is not very much efficient...But i was trying to
show how to tackle with big integers in C++ (i.e, using arrays)
On Thu, Mar 24, 2011 at 1:06 PM, radha krishnan
radhakrishnance...@gmail.com wrote:
You can do it in (log n) assuming multiplication is O(1)
suppose u are