Floyd algorithm lingo implementation