## Optimal Lopsided Trees in Data Structure

Updated on 07-Jan-2020 12:52:33
The problem of finding optimal prefix-free codes for unequal letter costs consists of computing a minimum cost prefix-free code in which the encoding alphabet consists of unequal cost (length) letters, of lengths α and β, where α ≤ β. We restrict ourselves limited to binary trees.The code is represented by a lopsided tree, in the similar way as a Huffman tree represents the solution of the Huffman coding problem. Despite the similarity, the case of unequal letter costs is much difficult than the classical Huffman problem; no polynomial time algorithm is known or available for general letter costs, despite a ... Read More

## Height Limited Huffman Trees in Data Structure

Updated on 07-Jan-2020 12:47:57
The diagram of height limited or depth limited Huffman tree is given belowTree depth limitation is a non-trivial issue that most real-world Huffman implementations must deal with.Huffman construction doesn't limit the height or depth. If it would, it is not possible for it to be "optimal". Granted, the largest depth of a Huffman tree is bounded by the Fibonacci series, but that leave sufficient room for larger depth than wanted.What is the reason to limit Huffman tree depth? Fast Huffman decoders implement lookup tables. It's possible to implement multiple table levels to mitigate the memory cost, but a very fast ... Read More

## Huffman Algorithm for t-ary Trees in Data Structure

Updated on 07-Jan-2020 12:45:40
A simple algorithmA collection of n initial Huffman trees is prepared, each of which is a single leaf node. Keep the n trees onto a priority queue organized by weight (frequency).Remove or delete the first two trees (the ones with smallest weight). Combine these two trees to create a new tree whose root is associated with the two trees as children, and whose weight is the sum of the weights of the two children trees.Keep this new tree into the priority queue.Repeat steps 2-3 until and unless all of the partial Huffman trees have been joined into one.It's a greedy ... Read More

## Huffman Codes and Entropy in Data Structure

Updated on 07-Jan-2020 12:34:25
Huffman CodeA Huffman code is defined asa particular type of optimal prefix code that is commonly used for lossless data compression.The process of finding or implementing such a code proceeds by means of Huffman coding, an algorithm which was developed by David A. Huffman while he was a Sc.D. student at MIT, and published in the 1952 paper "A Method for the Construction of Minimum-Redundancy Codes".The output from Huffman's algorithm can be displayed as a variable-length code table for encoding a source symbol (such as a character in a file). The algorithm creates this table from the estimated probability or ... Read More

## Splay in Virtual Tree in Data Structure

Updated on 07-Jan-2020 12:18:21
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. ... Read More

## Solid Trees in Data Structure

Updated on 07-Jan-2020 12:12:53
For the given forest, we create some of the given edges “dashed” and the rest of them are kept solid. Each non-leaf node is associated with only one “solid” edge to one of its children. All other children will be connected with the help of a dashed edge.To be more concrete, in any given tree, the right-most link (to its child) should be kept solid, and all other links to its other children are created “dashed”.As a result, the tree will be broken into a collection of solid paths. The roots of solid paths will be joined to some other ... Read More

## Static Finger Theorem in Data Structure

Updated on 13-Jul-2020 09:16:10
STATIC FINGER THEOREM − Let f is treated as a specific element called the finger.Then the below expression is a bound on the cost of splaying a sequenceO(m + n log(n) + Σ Sum log (|f - i[j]| + 1))jNOTE − |f-i| is denoted as the distance in the symmetric ordering of the items between the finger and item i.Where m is denoted as number of update or access operations on a tree having at most n nodes.Observe that, at least in amortized sense, the time taken for first m operations on a tree that never exceeds more than n ... Read More

## Optimality of Splay Trees in Data Structure

Updated on 07-Jan-2020 12:05:50
Dynamic optimality conjectureIn addition to the proven performance guarantees for splay trees there is an unproven conjecture with great interest. Dynamic optimality conjecture denotes this conjecture. Let any binary search tree algorithm such as B accesses an element y by traversing the path from the root to y at a cost of d(y)+1, and that between accesses can make any rotations in the tree at a cost of 1 per rotation. Let B(s) be the cost for B to perform the sequence s of accesses. Then the cost for a splay tree to perform the same accesses is O[n+B(s)].There are ... Read More

## Splay trees in Data Structure

Updated on 07-Jan-2020 12:03:35
play tree is defined as a self-balancing binary search tree with the extra property that recently accessed elements are quick to access again. Basic operations such as insertion, look-up and removal are performed by splay tree in O(log n) amortized time. For many sequences of non-random operations, splay trees work better than other search trees, even when the specific pattern of the sequence is not known. All normal operations on a binary search tree are joined with one basic operation, called splaying.Let us assume that for each node a, we store a real number key(a).In any binary search tree left ... Read More

## Adaptive Merging and Sorting in Data Structure

Updated on 07-Jan-2020 12:01:27
ADAPTIVE MERGE SORTAdaptive Merge Sort performs the merging of sorted sub-list merge sort does. However, the size of initial sub-list is depended upon the existence of ordering among the list of elements rather than having sub-list of size 1. For example, consider list in the figure.It consists of 2 sorted sub-lists.sub-list 1 with elements 16, 15, 14, 13.sub-list 2 with elements 9, 10, 11, 12.The sub-list 1 is sorted but in reverse order. Thus, the sub-list 1 is reversed as shown in the figure.Once the sub-lists are found merging process starts. Adaptive merge sort starts merging the sub-lists. Adaptive merge ... Read More