English 中文(简体)
算法的灵活性——演习
原标题:Comlexity of algorithms - exercises
  • 时间:2009-09-01 07:23:06
  •  标签:

I m learning for an exam in an introductory course to computer science, and i have a problem with the topic of complexity, both in "regular" algorithms and also in recursive algorithms (usually we get these questions written as C code).
I was wondering if there re online examples somewhere in the internet and/or book that covers the topic in a basic level (not too basic).
the level of the questions at least like this one:

sample exercise alt text http://img42.imageshack.us/img42/4456/ex1j.jpg

问题回答

Introduction to Algorithms. ......但需要一些数学知识才能理解。

The Lecture (video) for the Introduction to Algorithms course from MIT regarding the Asymptotic Notation is here

Cormen、Leserson和Rivest对Algorithms的介绍是我所了解的算法的最佳总体内容。

Aho、Hopcroft和Ullman设计和分析计算机Algorithms的情况也很好。 但是,与Algorithms的介绍相比,更难以作为引言案文加以消化。

我爱约恩·博特利的节目。 人人都应读到。

解决你的工作的正式办法是:

“entergraph

• 以C语文核查、执行以下方案(编辑是MinGW2.95):

#include <stdio.h>
#include <math.h>
int main() {
    int sumIN = 0, sumOUT = 0;
    double i, n = 500, j;
    double d;
    for (i = 1; i <= n; i ++) {
        d = 1/(double)i;
        j = i;
        while (j > 0 && d > 0) {
            j -= d;
            sumIN ++;
        }
        sumOUT ++;
    }
    printf("
sumIN = %d, sumOUT = %d", sumIN, sumOUT);
    printf("
");
    return 0;
}




相关问题
热门标签