Skip to content

Instantly share code, notes, and snippets.

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

Emerick Bosch xpcoffee

💭
☕ ⌨️ ⚙️
View GitHub Profile
@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 / 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-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-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-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-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-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 / ImportFNB.gs
Last active August 29, 2015 14:07
Script to help automate analysis of bank balances.
/*
Author: Emerick Bosch
This script imports new transaction history values.
Input is a .csv file - downloaded from FNB, Account, Transaction History.
The input .csv is uploaded to Google Drive and converted to a Google Sheet.
The input file name, as well as the google serial numbers of the input file and its containing folder are needed and entered below.
*/
@xpcoffee
xpcoffee / 0-shellsort.md
Last active August 29, 2015 14:07
Shell sort.

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

##Shellsort

Shellsort

####Concept

  • sequence of H-Sorts (with differing h values) which result in a fully sorted array.
  • sequence of h values must be well chosen as it has a significant effect on the runtime and efficiency of the operation
@xpcoffee
xpcoffee / 0-insertion-sort.md
Last active August 29, 2015 14:07
Insertion sort.

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

##Insertion Sort

gif

####Concept

  • iterate through items
  • with each iteration, a new item is 'discovered'