implementation algorithms with python