Splay Tree - Advantages

Advantages

Good performance for a splay tree depends on the fact that it is self-optimizing, in that frequently accessed nodes will move nearer to the root where they can be accessed more quickly. The worst-case height—though unlikely—is O(n), with the average being O(log n). Having frequently used nodes near the root is an advantage for nearly all practical applications (also see Locality of reference), and is particularly useful for implementing caches and garbage collection algorithms.

Advantages include:

  • Simple implementation—simpler than other self-balancing binary search trees, such as red-black trees or AVL trees.
  • Comparable performance—average-case performance is as efficient as other trees.
  • Small memory footprint—splay trees do not need to store any bookkeeping data.
  • Possibility of creating a 'persistent data structure' version of splay trees—which allows access to both the previous and new versions after an update. This can be useful in functional programming, and requires amortized O(log n) space per update.
  • Working well with nodes containing identical keys—contrary to other types of self-balancing trees. Even with identical keys, performance remains amortized O(log n). All tree operations preserve the order of the identical nodes within the tree, which is a property similar to stable sorting algorithms. A carefully designed find operation can return the leftmost or rightmost node of a given key.

Read more about this topic:  Splay Tree

Famous quotes containing the word advantages:

    ... there are no chains so galling as the chains of ignorance—no fetters so binding as those that bind the soul, and exclude it from the vast field of useful and scientific knowledge. O, had I received the advantages of early education, my ideas would, ere now, have expanded far and wide; but, alas! I possess nothing but moral capability—no teachings but the teachings of the Holy Spirit.
    Maria Stewart (1803–1879)

    For, the advantages which fashion values, are plants which thrive in very confined localities, in a few streets, namely. Out of this precinct, they go for nothing; are of no use in the farm, in the forest, in the market, in war, in the nuptial society, in the literary or scientific circle, at sea, in friendship, in the heaven of thought or virtue.
    Ralph Waldo Emerson (1803–1882)

    To become aware in time when young of the advantages of age; to maintain the advantages of youth in old age: both are pure fortune.
    Johann Wolfgang Von Goethe (1749–1832)