Dovetailing (computer science)
Encyclopedia
Dovetailing in algorithm design
Algorithm design
Algorithm design is a specific method to create a mathematical process in solving problems. Applied algorithm design is algorithm engineering....

, is a technique that interleaves different computation
Computation
Computation is defined as any type of calculation. Also defined as use of computer technology in Information processing.Computation is a process following a well-defined model understood and expressed in an algorithm, protocol, network topology, etc...

s, performing them essentially simultaneously. Algorithms that use dovetailing are sometimes referred to as dovetailers.

Consider a tree that potentially contains a path of infinite length: if a depth-first search
Depth-first search
Depth-first search is an algorithm for traversing or searching a tree, tree structure, or graph. One starts at the root and explores as far as possible along each branch before backtracking....

 is performed in this environment, the search may move down an infinite path and never return, potentially leaving part of the tree unexplored. However, if a breadth-first search
Breadth-first search
In graph theory, breadth-first search is a graph search algorithm that begins at the root node and explores all the neighboring nodes...

 is used, the existence of an infinite path is no longer a problem: each node is visited in a branching manner according to its distance from the root, so an infinite path will only impact the part of the search travelling down that path.

We can regard this tree as analogous to a collection of programs; in this case, the depth-first approach corresponds to running one program at a time, moving to the next only when the current program has finished running. In the case where one of the programs runs for an infinite amount of time, this transition will never happen. The breadth-first approach of visiting each child on the same level of the tree corresponds to dovetailing, where a single step is performed for every program before moving to the next. Thus, progress is made in each program, regardless of the potential existence of a program of infinite runtime.

In the case of an infinite number of programs, all potentially infinitely long, neither the breadth-first nor depth-first would be sufficient to ensure progress on all programs. Instead, the following technique can be used: perform the first step of the first program; next, perform the first step of the second program and the second step of the first program; next, perform the first step of the third program, the second step of the second program, and the third step of the first program; and so on.

Etymology

  1. The term might have come from dovetail card shuffling.
  2. An analogy with the interleaving ends of a dovetail joint
    Dovetail joint
    A dovetail joint or simply dovetail is a joint technique most commonly used in woodworking joinery. Noted for its resistance to being pulled apart , the dovetail joint is commonly used to join the sides of a drawer to the front....

     in woodworking
    Woodworking
    Woodworking is the process of building, making or carving something using wood.-History:Along with stone, mud, and animal parts, wood was one of the first materials worked by early humans. Microwear analysis of the Mousterian stone tools used by the Neanderthals show that many were used to work wood...

    .
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK