Various algorithms implementations I keep here for future reference.