- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Splay in Virtual Tree in Data Structure
In virtual tree, some edges are treated as solid and some are treated as dashed. Usual splaying is performed only in the solid trees. To splay at a node y in the virtual tree, following method is implemented.
The algorithm looks at the tree three times, once in each pass, and changes it. In first pass, by splaying only in the solidtrees, beginning from the node y, the path from y to the root of the overall tree, becomes dashed. This path is createdsolid by splicing. A final splay at node y will now create y the root of the tree. Less informally, the algorithm is explained as follows
Algorithm for Splay(y)
Pass 1 Walk up the virtual tree, but splaying is performed only within solid sub-tree. At the end of this pass, the path from y to root becomes dashed.
Pass 2 Walk up from node y, splicing at each proper ancestor of y. At the end of this step, the path from y to the root becomes solid. Except that, the node y and all its children in the original tree (the one before pass 1) now become left children.
Pass 3 Walk up from node y to the root, splaying in the normal fashion.
This allows us to utilize prior knowledge to improve our probability estimations. For the given set of leaves. So the goal is to construct a tree with the minimum external path weight.
An example is given below
Letter frequency table
The Huffman tree (for above example) is given below
- Splay trees in Data Structure
- Optimality of Splay Trees in Data Structure
- R* Tree in Data Structure
- Hilbert Tree in Data Structure
- Binary Tree ADT in Data Structure
- The B-tree in Data Structure
- Unrooted binary tree in Data Structure
- k-ary tree in Data Structure
- B-tree Deletion in Data Structure
- B-tree Query in Data Structure
- B-tree Insertion in Data Structure
- B+ tree Query in Data Structure
- The B+ tree in Data Structure
- B+ tree Deletion in Data Structure