Don't like this style? Click here to change it! blue.css

Class 20: Some Algorithmic Analysis

Now that you've played with really getting things done in code I want to introduce you to the idea of analyzing your way of solving a problem. But first, a rare opportunity to see original notions play out:

From Scratch Idea Task 1: Think out how you would solve this problem: Take in a list of integers. Return a list of those integers in sorted order. For instance: sort([5,3,4,1,2]) == [1, 2, 3, 4, 5]. Don't look on the internet for the answer, try to think out something that might work.

OK, by the time we leave today I want to have you know 1 or 2 "algorithms" that solve this problem, big-oh notation for classifying the speed of general programs, and for you to understand the worst-case performance of some classic algorithms.

The main take-home value, even for engineers, is this: when you design a program you have to be able to ballpark how long the code will take to run. That is today's goal.

I have some pretty notes that introduce this so let's go check that out now: cs.prof.ninja/slides/class2/#4

When that is done let's hit up: http://cs.prof.ninja/slides/class3/#3

Extras

Now let's watch some ammusing sorting videos:

Visual Comparison:

Dancing Sorts:

The LAST Daily Challenge

Implement "Selection-sort" (you can pick Python or MATLAB for the language).