Memory Bound Function - Memory Bound Functions and Memory Functions

Memory Bound Functions and Memory Functions

Memory bound functions and memory functions are related in that both involve extensive memory access, but a distinction exists between the two.

Memory functions use a dynamic programming technique called memoization in order to relieve the inefficiency of recursion that might occur. It is based on the simple idea of calculating and storing solutions to subproblems so that the solutions can be reused later without recalculating the subproblems again. The best known example that takes advantage of memoization is an algorithm that computes the Fibonacci numbers. The following pseudocode illustrates an algorithm that uses memoization, which runs in linear CPU time:

Fibonacci (n) { for i = 0 to n-1 results = -1 // -1 means undefined return Fibonacci_Results (results, n); } Fibonacci_Results (results, n) { if (results != -1) //check if it has already been solved before return results if (n == 0) val = 0 else if (n == 1) val = 1 else val = Fibonacci_Results(results, n -2 ) + Fibonacci_Results(results, n -1) results = val return val }

Compare the above to an algorithm that uses recursion, which runs in exponential CPU time:

Recursive_Fibonacci (n) { if (n == 0) return 0 else if ( n == 1) return 1 else return Recursive_Fibonacci (n -1) + Recursive_Fibonacci (n -2) }

While the recursive algorithm is simpler and more elegant than the algorithm that uses memoization, the latter has a significantly lower time complexity than the former. The term "memory bound function" has surfaced only recently and is used principally to describe a function that uses XOR and consists of a series of computations in which each computation depends on the previous computation. Whereas memory functions have long been an important actor in improving time complexity, memory bound functions have seen far fewer applications. Recently, however, scientists have proposed a method using memory bound functions as a means to discourage spammers from abusing resources, which could be a major breakthrough in that area.

Read more about this topic:  Memory Bound Function

Famous quotes containing the words memory, bound and/or functions:

    When he became all eye when one was present, and all memory when one was gone; when the youth becomes the watcher of windows, and studious of a glove, a veil, a ribbon, or the wheels of a carriage, when no place is too solitary, and none too silent.
    Ralph Waldo Emerson (1803–1882)

    Slight are her arms, yet they have bound me straitly
    And left me cloaked as with a gauze of ther;
    As with sweet leaves; as with subtle clearness.
    Ezra Pound (1885–1972)

    If photography is allowed to stand in for art in some of its functions it will soon supplant or corrupt it completely thanks to the natural support it will find in the stupidity of the multitude. It must return to its real task, which is to be the servant of the sciences and the arts, but the very humble servant, like printing and shorthand which have neither created nor supplanted literature.
    Charles Baudelaire (1821–1867)