Jan 25
plagiarism and copyright
- discuss; point at resources page
big O notation
Explain :
f ∈ O(g)
f ∈ Ω(g)
f ∈ Θ(g)
Discuss a few of the homework problems :
- 0.1b : n1/2 ∈ O(n2/3)
- 0.1i : 10 log(n) ∈ Θ(log(n2))
- 0.1n : n! ∈ Ω(2n)
sorting
First discuss algorithms and O() runtime.
Second look at specifics :
- attached python program
- attached C program
next
Textbook chapter 2 :
- divide and conquer algorithms
- basic idea
- thinking with recursion relations and trees
- tricky multiplication tricks
- mergesort
C programming :
- install gcc (if you don't already have it)
- (discuss mac vs windows vs unix)
- start staring at my sample program from this week
- try to rewrite something simple you've done before
Here's a short C program :
#include <stdio.h>
#include <math.h>
int main(){
int i; // Declaring an integer.
for (i=0; i<10; i++){ // A typical loop
printf(" %3i %8.5f \n", i, sqrt(i));
}
}
And here's to run it :
$ gcc sqrt.c -o sqrt
$ ./sqrt
0 0.00000
1 1.00000
2 1.41421
3 1.73205
4 2.00000
5 2.23607
6 2.44949
7 2.64575
8 2.82843
9 3.00000