An algorithm is a process or logic definition that is followed to perform a task or to transform data within a program. In the most basic sense, it is the recipe that must be followed in order to get from point A to point B.
It is a sequence of events that have to be followed in an application to perform a certain action where incoming data gets transformed and is computed to eventually produce an output.