Homework Assignment #1
CMPUT 204
Department of Computing Science
University of Alberta
Due: by Sept 25, 2016
Note: All logarithms are in base 2 unless specified otherwise. We denote R+ = cfw_x R : x >
Midterm
CMPUT 204
Department of Computing Science
University of Alberta
Length: 50 min
Your name and CCID:
Note: All logarithms are in base 2 unless specified otherwise. We denote R+ = cfw_x R : x > 0
CMPUT204: Introduction to Algorithms
Midterm
Name
CCID
Student ID
Fall 2016
Instructions
Closed books.
You may use a scientific calculator.
Collaborations of any kind are strictly forbidden.
Note:
Homework Assignment #1
CMPUT 204
Department of Computing Science
University of Alberta
Due: Oct 9th, 2017
Note: All logarithms are in base 2 unless specified otherwise. We denote R+ = cfw_x R : x > 0
CMPUT 229 - Computer Organization and Architecture I
Homework #1
Prof. Jose Nelson Amaral - Computing Science - University of Alberta
Question 1: Assume that B is an array of 32-bit unsigned integers,
CMPUT 229 - Computer Organization and Architecture I
Homework #2
Prof. Jose Nelson Amaral - Computing Science - University of Alberta
Question 1:
A computer program takes 800 seconds to execute 2.5 10
Notes
Loop Invariants
Agenda:
I
Identifying loop invariants
I
I
I
I
Q1: Do I understand what the loop does?
Q2: Do I understand the cumulative effect of the loop?
Q3: Can I word exactly the cumulative
Math 101
Seminars
CMPUT 204
Logarithms
Definition of a logarithm:
y= log a X, if and only if a y = X,
where a>0.
Properties of Logarithm
If m, n and b are positive numbers, b 1 then
1. log b b =1
2. l
Week 6: More Divide and Conquer
Notes
Agenda:
I
Divide and Conquer technique
I
Multiplication of large integers
I
Exponentiation
I
Matrix multiplication
Divide and Conquer :
I
To solve a problem we ca
Notes
Week 10: DFS
Agenda:
I
I
Graph traversal Depth-first search
DFS application:
I
I
I
Finding biconnected components
Strongly Connected components
Topological sorting
Reading:
I
CLRS: 603-621
Week
Midterm
CMPUT 204
Department of Computing Science
University of Alberta
Length: 50 min
Your name and CCID:
Note: All logarithms are in base 2 unless specified otherwise. We denote R+ = cfw_x R : x > 0
Announcement
Midterm:
I
I
Friday, 28th Oct, 50 mins, in class.
Mandatory
I
I
I
If you miss it (for a valid reason), you must take a makeup mid-term.
Structure: 3 Problems.
Problem 1: 5 small questions
Homework Assignment #2
CMPUT 204
Department of Computing Science
University of Alberta
Due: Oct 10, 2016
Note: All logs are in base 2, unless specified otherwise.
n
n
P
You can also use the facts that
Week 4: Heapsort, Quicksort
Notes
Agenda:
I
Heaps:
I
I
I
Max-Heapify
Build-Max-Heap
Heapsort
I
Priority Queues
I
Quicksort
Reading:
I
CLRS: 151-169
CLRS: 170-190
Week 4: Heaps
Notes
Heaps data structu
Notes
Week 11: Shortest Path Problems
Agenda:
I Single-Source Shortest Path problem (SSSP)
I
I
I
Dijkstras algorithm for the non-negative weights case
Bellman-Ford algorithm for graphs with no negativ
Midterm
CMPUT 204
Department of Computing Science
University of Alberta
Length: 50 min
Your name and CCID:
Note: All logarithms are in base 2 unless specified otherwise. We denote R+ = cfw_x R : x > 0
Stacks and Queues
Notes
Agenda:
I
Stacks
I
Queues
I
Basics of Amortized Analysis
Stacks and Queues:
I
Two highly uses data-structures
I
Supporting Insert and Remove in O(1) time
Implementing LIFO/FIFO
Notes
Week 2: Types of analysis of algorithms, Asymptotic notations
Agenda:
I
Worst/Best/Avg case analysis
I
InsertionSort example
I
Loop invariant
I
Asymptotic Notations
I
Refreshment on logs and exp
Notes
Week 1: Introduction, Basic Concepts
CMPUT204: Introduction to Algorithms
Agenda:
I
Course information
I
Algorithms concepts
I
Induction proofs
I
Pseudo-code, RAM model
week 1: Introduction
Offi
Horners Rule for polynomial
evaluation
Seminars
CMPUT 204
Polynomial
An expression consisting of variables and coefficients which only employs the
operations of addition, subtraction, multiplication,
CMPUT 204
Introduction to Algorithms
Seminar Wednesday
Jincheng and Chao
Towers of
Hanoi
It is a simple puzzle which starts with 3
rods and number of disc of various sizes
which can slide into them.
S
Notes
Week 8: Dynamic programming
Agenda:
I
0/1 Knapscak
I
Chain Matrix Multiplication
I
Longest Common Subsequence
Week 8: Dynamic Programming
Dynamic programming introduction:
Notes
I
An algorithm d
Week 7: Greedy Algorithms
Notes
Agenda:
I
Greedy Algorithms
I
Fractional Knapsack
I
Coin Changing
I
Activity Selection
I
Job Scheduling on Multi-processors
Greedy Method:
I
In an optimization problem
Week 9: Graphs and Graph Traversals
Agenda:
Notes
Graphs basic definitions
Graphs Representation
I Graph Traversals: Breadth First Search (BFS) and applications
Reading:
I CLRS: 589-602
I
I
A Graph:
4
Week 3: Solving recurrences, Heaps
Notes
Agenda:
I
Divide and Conquer and analyzing recursive programs
I
Solving recurrences
I
Iterated substitution
I
Recursion tree method
I
Guess and test method
I
M
Midterm
CMPUT 204
Department of Computing Science
University of Alberta
Length: 50 min
Name and CCID:
Note: All logarithms are in base 2 unless specified otherwise. We denote R+ = cfw_x R : x > 0
Prob
Notes
Week 5: QuickSort, Randomness, Lower bound
Agenda:
I
QuickSort : Worst, Best and Average case
I
Random QuickSort
I
Lower bound for sorting
Reading:
I
CLRS: 170-193
Week 5: QuickSort
Recall Quick
Midterm
CMPUT 204
Department of Computing Science
University of Alberta
Length: 50 min
Name and CCID:
Note: All logarithms are in base 2 unless specified otherwise. We denote R+ = cfw_x R : x > 0
Prob
Announcement
Quiz:
I
I
Monday, 26th Sep, 10 mins, in class.
Optional!
I
I
I
Dont have to take it, and even if you do it will not hurt your grade.
Can give you 2% bonus to overall grade.
Structure: 4 q
Unit 6: Tree-Based Data-Structures
Agenda:
I
Heaps:
I
I
Max-Heapify
Build-Max-Heap
I
Heapsort
I
Priority Queues
Binary Search Trees
I
I
I
I
I
Find()
Insert(), Delete()
Successor()
Balancing BST
I
Red-
Unit 3: Run-Time Analysis Fundamentals
Agenda:
I
The Problem:
I
I
I
Not all correct codes are the same (Fibonacci)
Not all instances are the same (Insertion Sort) (CLRS 24-28)
Asymptotic Growth of Fun
Unit 2: Correctness
Agenda:
I
Recursions & Induction
I
Recursions to Loops
I
Loop invariants (CLRS p.18-20)
1/36
Unit 2: Proving Correctness
Why Prove Correctness
I
So far we have discussed how to wri
Unit 1: Introduction, Basic Concepts
CMPUT204: Introduction to Algorithms
Agenda:
I
Course Information
I
Algorithms concepts (Ch. 1.1)
I
Pseudo-code (p. 20-22 but somewhat different from our conventio
Unit 5: Divide and Conquer
Agenda:
I
Divide and Conquer technique
I
The classic example: Merge Sort (CLRS p.30-39)
I
Exponentiation (CLRS p.956-958 [ mod p])
I
Karatsubas algorithm for multiplying lar