Skip to content

Instantly share code, notes, and snippets.

View xpcoffee's full-sized avatar
💭
☕ ⌨️ ⚙️

Emerick Bosch xpcoffee

💭
☕ ⌨️ ⚙️
View GitHub Profile
@xpcoffee
xpcoffee / 0-stack.md
Last active August 29, 2015 14:07
Stacks - fundamental data type to manage a collection of objects

These are part of my notes for the Coursera course: Algorithms, Pt I (Princeton).

##Stack

stack wikipic

####Concept

  • one of the fundamental data types used to manage a collection of objects
  • works like a 'stack' of plates
  • plates can only be added or removed from the top of the pile
@xpcoffee
xpcoffee / 0-Queue.md
Last active August 29, 2015 14:07
Queue - fundamental data type to manage collections of objects.

These are part of my notes for the Coursera course: Algorithms, Pt I (Princeton).

##Queue

queue wikipic

####Concept

  • one of the fundamental data types used to manage a collection of objects
  • works like a 'queue' of people
  • people enter from the back of the queue and leave from the front
@xpcoffee
xpcoffee / 0-basic-mergesort.md
Last active August 29, 2015 14:07
Basic Mergesort

These are part of my notes for the Coursera course: Algorithms, Pt I (Princeton).

##Basic Mergesort

mergsort

####Concept

  • halve array, creating 2 sub-arrays
  • sort each sub array
  • merge the sub arrays back together
@xpcoffee
xpcoffee / 0-bottom-up-mergesort.md
Last active March 22, 2023 10:28
Bottom Up Mergesort.

These are part of my notes for the Coursera course: Algorithms, Pt I (Princeton).
Information on basic Mergesort can be found here.

##Bottom-Up Mergesort

####Concept

  • we know :
    • normal Mergesort recurs, halving the array until we hit sub-arrays/ranges of size 1
    • it is only from here that sorting starts to happen
  • instead of recurring down from the full array, start with ranges of size 1
@xpcoffee
xpcoffee / 0-stability-sorts.md
Last active August 29, 2015 14:07
Sort Stability

These are part of my notes for the Coursera course: Algorithms, Pt I (Princeton).

##Stability (Sorts)

####Definition

  • ability of a sort to keep the current order of equal items while sorting.
    • important if sorting by different keys (e.g. first by song name, then by artist)

####Stable sorts | Sort | Stability |

@xpcoffee
xpcoffee / 0-comparators.md
Last active August 29, 2015 14:07
Java Comparator Interface

##Java Comparator Interface

####Concept

  • Comparables are the basic interface java offers to compare two objects
    • classes that implement Comparable must provide a compareTo method
    • the compareTo method determines what is known as the natural order in which objects of that class are sorted
  • comparators enable us to define a compare statement outside of a class
  • this allows us to redefine sorting order to be different than the natural order
@xpcoffee
xpcoffee / 0-quicksort.md
Last active August 29, 2015 14:07
Quicksort algorithm - the fastest way to currently sort.

These are part of my notes for the Coursera course: Algorithms, Pt I (Princeton).
This requires knowledge of Partitioning.

##Quicksort

quicksort gif

####Concept

  • we know
  • partitioning places smaller items on the left and larger items on the right of a selected value
@xpcoffee
xpcoffee / ThreeWayQuick.java
Last active August 29, 2015 14:07
3 way quicksort.
import java.util.Comparator;
public class ThreeWayQuick{
public static void sort(Comparable[] a)
{
StdRandom.shuffle(a);
sort(a, 0, a.length - 1);
}
@xpcoffee
xpcoffee / stack-vs-heap-basics.md
Last active August 29, 2015 14:08
Stack vs Heap

####Stack vs Heap in C-languages

Stack
A stack is memory set aside for running code. Typically, calls to functions create temporary variables.
These variables are stored on the stack.

Stacks are a LIFO (last in, first out) structure.

Heap

@xpcoffee
xpcoffee / dns-basics.md
Last active August 29, 2015 14:09
Domain Name System

##Domain Name System (DNS)

This is the system that allows a pc to navigate to the right page on the internet.

###The Nature of Internet Addresses Addresses on the internet are actually IP addresses (Internet Protocol) like 74.125.228.200 - Google.

IP is well defined and standardized and it has proven to be a reliable method for locating individual devices within large networks. Browsers and computers have these standards coded in them and can use them quickly and efficiently to find and communicate with each other.

However, IP addresses are not human-friendly. Lists of four numbers are hard to remember and do not give any information about the nature of the site, for example: