Last active
April 27, 2020 18:00
-
-
Save Mario-SO/272e5901ca9022bfb39874ead26d1f6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public ArrayList greedy(ArrayList candidates) { | |
| solution; | |
| while (!isSolution(solution) && (candidatesLeft(candidates)) { | |
| cadidate = selectCandidate(candidates); | |
| removeCandidate(candidate, candidates); | |
| if (isGoodCandidate(candidate, solution)) { | |
| addCandidate(candidate, solution); | |
| } | |
| } | |
| if (isSolution(solution)) { | |
| return solution; | |
| } else { | |
| return null; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment