Identify the algorithm which works on the principle that locally optimal solutions are globally optimal.
$\left ( A \right )$ Divide and Conquer
$\left ( B \right )$ Greedy
$\left ( C \right )$ Dynamic Programming
$\left ( D \right )$ All of the above