An algorithm is a step-by-step procedure or a set of rules designed to perform a task or solve a specific problem. An algorithm is like a recipe – a set of clear instructions to solve a problem or accomplish a task.