Skip to content

Instantly share code, notes, and snippets.

@pyk
Created July 22, 2015 23:56
Show Gist options
  • Save pyk/ff249882f0b5d15cea29 to your computer and use it in GitHub Desktop.
Save pyk/ff249882f0b5d15cea29 to your computer and use it in GitHub Desktop.
Exercise 1.2-2 & 1.2-3 on Introduction to Algorithm book by Cormen et al.
#include <stdio.h>
#include <math.h>
int
main()
{
int n;
for(n = 1; n < 10000; n++) {
if((8*pow(n,2)) < (64*n*log(n))) {
printf("1.2-2 terakhir n = %d\n", n);
break;
}
}
for(n = 1; n < 10000; n++) {
if((100*pow(n,2)) < (pow(2,n))) {
printf("1.2-3 terakhir n = %d\n", n);
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment