Skip to content

Instantly share code, notes, and snippets.

Control Flow

Objectives

  • If Statements
  • Each Loops
  • While Loops
  • Exercises!

#SORTS

  • Selection Sort: This algorithm works by examining a contiguous sublist of the original list. It finds the nth largest element in the list and swaps it with the nth element. It then examines n-1 terms. Selection sort runs in Θ(n2) time for worst, bets, and average case scenarios.
  • Bubblesort: This algorithm works by swapping consecutive elements that are unordered. It ex- amines two consecutive elements at a time. Bubblesort terminates when it completes an iteration through the list without swapping any elements. It runs in O(n2) time for average and worst cases, and O(n) time if the list is already sorted.
  • Insertion Sort: This algorithm works by examining a larger contiguous subset of the original list on each iteration. On the first iteration, only elements at indices 0-1 are examined. If they are out of order, they are swapped. On the next iteration, elements at indices 0-2 are examined. The element at index 2 is pulled out of the list and compared against the preceding one-by-one while it is bi
@Colt
Colt / morning.html
Last active August 29, 2015 14:06
The notes and schedule for Saturday's HTML and CSS workshop.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="cookie_styles.css">
<title></title>
</head>
<body>
<h1>hello this is an h1!! <a href="http://www.google.com">Go To Google </a>
</h1>
@Colt
Colt / sunday.md
Last active August 29, 2015 14:06
<!DOCTYPE html>
<html>
<head>
<title>Example 9</title>
<style>
body {
margin: 0;
font: normal 12px/18px 'Helvetica', Arial, sans-serif;
background: #44accf;
}
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/css/semantic.css">
<style type="text/css">
.menu form{
display: inline;
}
@Colt
Colt / year_up.md
Created December 1, 2014 06:29
Year Up Front End Crash Course
body{
text-align: center;
background: url("http://dash.ga.co/assets/anna-bg.png");
background-size: cover;
background-position: center;
color: white;
font-family: helvetica;
}
p{
# Simple Singly Linked List Implementation in Ruby
class Node
attr_accessor :value, :next_node
def initialize(value)
@value = value
end
end
class LinkedList
def initialize(value)
require 'nokogiri'
class Review
attr_reader :raw, :date, :stars, :user, :body
def initialize(html='')
@data = html
@date = extract_meta('datePublished')
@stars = extract_meta('ratingValue')
@user = extract_user