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的介绍相比,更难以作为引言案文加以消化。
我爱约恩·博特利的节目。 人人都应读到。
我也建议通过麻省理工学院的这些视频讲座,可在以下网站查阅:http://academicearth.org/courses/introduction-to-algorithms”rel=“nofollow noreferer”>http://academicearth.org/courses/introduction-to-algorithms。 。
Good Luck!
My first advice to you would be that don t move forward to new topics until you get the Complexity part. As for the text to consult, Introduction to Algorithm by Cormen is a good option. See basically there are three ways to express complexity Big-oh, omega and theta notation. The calculation of complexity for iterative algorithms is pretty simple. Go through any book and practice some examples. For recursive algorithm read Masters theorem. Using this theorem you can easily calculate complexity for most of the recursive questions. Search for masters theorem on net and you will find several good tutorials.You can start from here http://en.wikipedia.org/wiki/Master_theorem.
解决你的工作的正式办法是:
• 以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;
}
- winforms
- combobox
- fogbugz
- java
- date
- internationalization
- asp.net
- iis
- url-rewriting
- urlrewriter
- c#
- enums
- ocaml
- haxe
- algorithm
- string
- viewstate
- .net
- c++
- c
- symbol-table
- mysql
- database
- postgresql
- licensing
- migration
- vb.net
- vb6
- declaration
- vb6-migration
- python
- psycopg2
- backup
- vmware
- virtualization
- gnu-screen
- authentication
- desktop
- excel
- xll
- cultureinfo
- regioninfo
- oracle
- client
- session
- download
- html
- virtual
- constructor
- scenarios
- perl
- full-text-search
- javascript
- ajax
- testing
- oop
- inheritance
- vim
- encapsulation
- information-hiding