An algorithm is correct if it behaves as specified, meaning each input produces the correct output for its specifications.