In computer science, a dancing tree is a tree data structure similar to B+ trees. It was invented by Hans Reiser, for use by the Reiser4 file system. As opposed to self-balancing binary search trees that attempt to keep their nodes balanced at all times, dancing trees only balance their nodes when flushing data to a disk (either because of memory constraints or because a transaction has completed).
The idea behind this is to speed up file system operations by delaying optimization of the tree and only writing to disk when necessary, as writing to disk is thousands of times slower than writing to memory. Also, because this optimization is done less often than with other tree data structures, the optimization can be more extensive.
In some sense, this can be considered to be a self-balancing binary search tree that is optimized for storage on a slow medium, in that the on-disc form will always be balanced but will get no mid-transaction writes; doing so eases the difficulty (at the time) of adding and removing nodes, and instead performs these (slow) rebalancing operations at the same time as the (much slower) write to the storage medium.
However, a (negative) side effect of this behavior is witnessed in cases of unexpected shutdown, incomplete data writes, and other occurrences that may prevent the final (balanced) transaction from completing. In general, dancing trees will pose a greater difficulty for data recovery from incomplete transactions than a normal tree; though this can be addressed by either adding extra transaction logs or developing an algorithm to locate data on disk not previously present, then going through with the optimizations once more before continuing with any other pending operations/transactions.
Famous quotes containing the words dancing and/or tree:
“Players, Sir! I look on them as no better than creatures set upon tables and joint stools to make faces and produce laughter, like dancing dogs.”
—Samuel Johnson (17091784)
“A tree is made to live in peace in the color of day and in friendship with the sun, the wind and the rain. Its roots plunge in the fat fermentation of the soil, sucking in its elemental humors, its fortifying juices. Trees always seem lost in a great tranquil dream. The dark rising sap makes them groan in the warm afternoons. A tree is a living being that knows the course of the clouds and presses the storms because it is full of birds nests.”
—Jacques Roumain (19071945)