Okay, so i got the volume I of Sedgewick's Algorithms in C++ and I'm pretty much lost in the first chapter. I understand all the given examples and such things but the exercises seem impossible. I'm still just starting highschool and the math used there aren't that easy and the problems given aren't explained in the text and there are no given solutions to these problems... anyone knows a good math book i could use to "get it all", or even better, are there any solutions to these problems on the net?

what kind of math are we talking here? what do the symbols look like, example of algorithm, etc. ?

one problem for example is like this:

int i, j, k, count = 0;
for( i = 0; i < N; i++ )
       for( j = 0; j < N; j++ )
              for( k = 0; k < N; k++ )
                     count++;

develop an expression of the form c0 + c1*N + c2*N^2 + c3*N^3 that accurately describes the running time of your program...
i get the c things, they are some kind of constants, right? but the operations i see here are N + N^2 + N^3 for the increments of the for loops and N^3 for the count variable increments... so now i get confused...

>I understand all the given examples
Really? I still don't understand how some of those examples are expected to work, they're so buggy and poorly written. :icon_rolleyes:

>but the exercises seem impossible
You're pretty much expected to be a graduate student taking higher mathematics courses to do those exercises. Don't worry about them, instead focus on the questions that have you writing code rather than proofs.

>anyone knows a good math book i could use to "get it all"
Look for books on discrete mathematics. That should cover most everything you need for algorithm analysis.

commented: totally, i mean totally made my day... he deserves the rep!!! +1

wow...narue...that's the answer i was hoping for!!! you made my day! seriously!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.