Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.
For the best experience please use the latest Chrome, Safari or Firefox browser.
CIS 115
Lecture 7: Algorithms
How do you shuffle cards?
Algorithm
A finite list of specific instructions for carrying out a procedure or solving a problem
Euclid
Image Source: Wikipedia
Euclid's Algorithm (GCD)
Example: GCD of 1071 & 462
Example: GCD of 1071 & 462
Sorting Algorithms
Insertion Sort
Image Source: Wikipedia
Bubble Sort
Image Source: Wikipedia
Big O Notation
Image Source: Wikipedia
Big O Notation
Bubble Sort - Worst Case?
Bubble Sort - Worst Case?
Bubble Sort - Worst Case?
Sorting Algorithms
Merge Sort
Image Source: Wikipedia
Merge Sort
Quicksort
Image Source: Wikipedia
Quicksort
Sorting Algorithms
What is a Heuristic?
Using experience based techniques to find a satisfactory solution to a problem (which may or may not be the absolute best solution)
Everyday Heuristics
Tradeoffs
Image Source: Wikipedia
Travelling Salesman Problem
Image Source: Wikipedia
Travelling Salesman Problem: Algorithms
Travelling Salesman Problem: Heuristic
Nearest Neighbor (Greedy Algorithm)
Travelling Salesman Problem: Heuristic
Nearest Neighbor (Greedy Algorithm) - O(d n)
Time can vary widely based on how the data is presented and sorted
Assignments
Blog 3: Algorithms
Think about something that you do every day. That one thing probably is composed of many smaller steps, which you have to perform in the correct order. How would you describe those steps to someone unfamiliar with the action? How would you describe them to a robot that can follow your actions? While we may not think of it in this way very often, most of our daily lives could be expressed as an algorithm. Choose a few examples of actions you perform often, and write about how you would express them as algorithms. Some things to consider:
Scratch Sorting Algorithms
Due Wednesday, 2/19 10:00 PM
Bubble Sort
Image Source: Wikipedia