My implementation (tested) of some algorithms