4: The algorithm calls for first collecting all candidates: critical points of f that are in M and endpoints of M.

Next hint
Answer