Recursion (computer Science) - Order of Execution

Order of Execution

In a recursive function, the position in which additional statements (i.e., statements other than the recursive call itself) are placed is important. In the simple case of a function calling itself only once, a statement placed before the recursive call will be executed first in the outermost stack frame, while a statement placed after the recursive call will be executed first in the innermost stack frame. Consider this example:

Read more about this topic:  Recursion (computer Science)

Famous quotes containing the words order and/or execution:

    Where mass opinion dominates the government, there is a morbid derangement of the true functions of power. The derangement brings about the enfeeblement, verging on paralysis, of the capacity to govern. This breakdown in the constitutional order is the cause of the precipitate and catastrophic decline of Western society. It may, if it cannot be arrested and reversed, bring about the fall of the West.
    Walter Lippmann (1889–1974)

    It is clear that in a monarchy, where he who commands the exceution of the laws generally thinks himself above them, there is less need of virtue than in a popular government, where the person entrusted with the execution of the laws is sensible of his being subject to their direction.
    —Charles Louis de Secondat Montesquieu (1689–1755)