Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to speed up this factorial code n=100000 under 10000 Millisecond. include include include include include #define nDEFAULT 100 #define LEN 1000000 123456 /when

image text in transcribed
image text in transcribed
I need to speed up this factorial code n=100000 under 10000 Millisecond.
include include include include include #define nDEFAULT 100 #define LEN 1000000 123456 /when compiled with -01 optimization 10000 312.8 msec 1 100000, 40478.3 msec static unsigned int factorial(LEN), len; static void calcfactorial(unsigned int n) { unsigned int carry, i, ji len = factorial[e] = 1; for (i = 1; i @; i--) printf("%1d", factorialli - 21); printf(" "); } static void printfootoris!(void) { int i; for (i = len; i > e; i--) printf("%10", factorialli - 1]); printf(" "); /*** * make changes before this block * Do NOT change anything in main() ******** */ int main(int argc, char *argv[]) { int c, n = NDEFAULT, debug = @; struct timeval te, t1; float elapsed; while ((c = getopt(arge, argv, "d:n:")) != -1) { switch (c) { case d': sscanf(optarg, "%d", &debug); break; case 'n': sscanf(optarg, "%d", &n); break; default: break; } > if (n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions