Skip to content

Instantly share code, notes, and snippets.

View Bersaelor's full-sized avatar
🏠
Working from home

Konrad Feiler Bersaelor

🏠
Working from home
View GitHub Profile
@Bersaelor
Bersaelor / smoothsort.swift
Created March 26, 2017 15:52 — forked from kazk/smoothsort.swift
Smoothsort in Swift
// Swift3 adaption of https://gist.github.com/kazk/5c660d071642193f5301 by https://github.com/kazk
// An implementation of [Smoothsort] algorithm invented by Edsger Dijkstra,
// which I didn't get until reading [Smoothsort Demystified] by Keith Schwarz.
//
// Some optimizations like the chained swaps and corner case elimination were
// derived from [smoothsort.c] by Martin Knoblauch Revuelta.
func smoothsort<T : Comparable>( a: inout [T]) {
smoothsort(&a) { $0 < $1 }
@Bersaelor
Bersaelor / 0_reuse_code.js
Created August 22, 2016 07:33
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console