Review

https://slides.com/georgelee/ics141-final-review/live

We covered a lot!

Final Exam

  • Thursday, Dec. 17th 4:30-6:30
  • 10-12 Questions
  • Not Comprehensive
  • Open notes (no book)

Algorithms

What is an Algorithm?

Basic Algorithms

  • Find the largest/smallest number in a list
  • Sum the numbers in a list
  • Find the even numbers in a list
  • Making change (greedy algorithm)

Searching and Sorting

  • Non-recursive
  • Linear search and binary search
  • Bubble sort / Insertion sort

Growth of functions

  • Big O notation
  • Upper bound on the function
  • O(1) < O(log n) < O(nk) < O(bn)
  • Other notations

Complexity of Algorithms

  • Time Complexity
  • Worst case complexity
  • Counting the number of operations.
  • What is the complexity of linear search? Binary search? Sorting algorithms?

Data Representations

Numbers in other Bases

  • Binary, Octal, and Hexadecimal
  • How do we convert these to decimal?
  • How do we convert numbers from decimal?
  • Signed and unsigned integers

Numbers in other Bases

  • Binary, Octal, and Hexadecimal
  • How do we convert these to decimal?
  • How do we convert numbers from decimal?
  • Signed integers

Adding and Subtracting

  • How do we do these in base 10?
  • Translate this process into any base.

Modulo Arithmetic

  • When we divide two integers, we get a quotient and a remainder
  • Modulo congruence (8 mod 12 = 20 mod 12)
  • There are multiple theorems associated with congruence

Primes

Prime Numbers

  • Algorithm for determining if a number is prime
  • Sieve of Erastothenes

Greatest Common Divisor

  • Can break down into prime factors
  • Use the Euclidean Algorithm
  • Let a = bq + r, where a, b, q, and r are integers. Then gcd(a, b) = gcd(b, r).

Induction

Inductive Proofs

  • Basis step and the Inductive step (P(k) → P(k + 1) )
  • Strong Induction
    [P(b) ^ P(b + 1) ^ P(b + 2) ... P(k)] -> P(k + 1)

Recursive Definitions

  • Define a function in terms of itself
  • Base case, inductive case
  • Consider the Fibonacci Sequence
  • Strings

Recursive Algorithms

  • Thinking recursively
  • Define linear/binary search recursively
  • Recursive Euclidean Algorithm
  • Sorting (Merge Sort and Quick Sort)

Counting

Basic Counting

  • Product Rule
  • Sum Rule
  • Inclusion-Exclusion Principle
  • Pigeonhole Principle

Permutations and Combinations

  • Permutations are an ordered subset of a set
  • Combinations are an unordered subset of a set
  • Consider when order matters and when it does not.

With Replacement

  • Permutations are straight product rule.
  • Combinations with replacement are trickier
    C(n + k - 1, k) = (n + k - 1)! / k! (n - 1)!
  • Permutations with indistinguishable objects

Final Review

By George Lee

Final Review

  • 907