My algorithm implementations