What’s a Splay Tree?

Print anything with Printful



A splay tree is a self-tuning binary search tree that stores recently accessed nodes near the top for faster access. It has five functions and a small memory footprint, but accessing lower nodes can be slow due to linear organization.

A splay tree is a binary-optimized search tree or node-based data tree that self-tunes and provides access to recently searched items and nodes. Five functions can be performed on the splay tree, allowing the user to manipulate the nodes. This tree has a very small footprint, so little memory is needed to store the data. One drawback of this tree is that it is built linearly, so downward stored nodes will take longer to access.

View trees are binary trees that store data nodes; this is usually binary data, although it can also contain files. Unlike a regular binary search tree, which allows users to search across nodes, a splay tree shifts to make searching much faster. All recently opened nodes will be placed near the top of the tree, so it takes less time to find and open the node. This reorganization means that splay trees are useful for caches—computer memory that holds recently accessed data—and for algorithms built to purge unused data.

Five functions can be used on the tree. The splay operation is like a join operation, because the access of one node is connected with another node. The split function takes a node and splits it into two or more nodes. With join, two nodes are transformed into one. Insert takes part of one node and inserts it into another, while the delete function deletes a section of the node from the splay tree.

A splay tree uses very little memory, which allows users to build large trees without taking up a huge amount of hard drive space. Splay trees are simple and don’t require much code to compile, so they don’t require as much memory as more complex trees. Accounting information, which is usually needed by other trees to track data placement, is not needed due to the automatic reorganization nature of the tree.

While the splay tree takes up little memory and can access recent nodes easily, speed can be an issue. Nodes can only be arranged linearly, which means that some nodes will be at the bottom of the tree, while recent nodes are at the top. These lower nodes will be difficult to reach, because the tree has to search down until the lower nodes are found. This is because there is no accounting data, resulting in slow searches for low nodes.




Protect your devices with Threat Protection by NordVPN


Skip to content