Show Menu
Cheatography

CSCI060 Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Dog Class

public class Dog {
    int myAge:
    public Dog(int inputAge) {
        this.myAge = inputAge;
    }

    public void getOlder() {
        this.myAge++;
    }

    public String toString() {
        return "This dog is " + this.myAge + "years old";
    }

    public static void main(String[] args) {
        Dog fido = new Dog(2);
        fido.getOlder();
        System.out.println(fido);
    }
}

Java For Loop

for (int count = 0; count < 100; count = count + 1){
    //Do Something Here
}

Big-O Order (slowest to fastest)

n^n
n!
2^n
n^3
n^2
nlog(n)
n^n
sqrt(n)
log(n)
1
 

Loop Counting

i=0
N+1
i=1
N+1
i=2
N+1
...
...
i=N-1
N+1
i=N
N=1
Total:
N^2 + N
Big-O
O(N^2)
for (int i=0; i<= N; i++){
for (int z=0; z <= N; z++{
//constant time operation
}
}