Optimal Lopsided Trees in Data Structure

Arnab Chakraborty
Updated on 07-Jan-2020 12:52:33

323 Views

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

Relative Positioning in CSS

AmitDiwan
Updated on 07-Jan-2020 12:48:08

562 Views

We can define positioning of an element in CSS as relative which renders the element normally. Elements with positioning method as relative are positioned by CSS Positioning properties (left, right, top and bottom).ExampleLet’s see an example for CSS Relative Positioning Method − Live Demo p {    margin: 0; } div:first-child {    position: relative;    top:20px;    background-color: orange;    text-align: center; } PostgreSQL PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development................. OutputFollowing is the output for the above code −ExampleLet’s see ... Read More

Height Limited Huffman Trees in Data Structure

Arnab Chakraborty
Updated on 07-Jan-2020 12:47:57

642 Views

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

Arnab Chakraborty
Updated on 07-Jan-2020 12:45:40

623 Views

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

Remove Dotted Line Around Active Links Using CSS

AmitDiwan
Updated on 07-Jan-2020 12:35:32

3K+ Views

We can remove the default behavior of hyperlinks which is to show a dotted outline around themselves when active or focused by declaring CSS outline property on active/focused links to be none.Solutiona, a:active, a:focus {    outline: none; }ExampleLet’s see how to remove dotted line around active links with an example − Live Demo Remove dotted line around links using css div {    color: #000;    padding:20px;    background-image: linear-gradient(135deg, #dc3545 0%, #9599E2 100%);    text-align: center; } a, a:active, a:focus {    outline: none; } HTML Links Demo Go To Google ... Read More

Huffman Codes and Entropy in Data Structure

Arnab Chakraborty
Updated on 07-Jan-2020 12:34:25

2K+ Views

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

Static Positioning Using CSS

AmitDiwan
Updated on 07-Jan-2020 12:27:50

1K+ Views

We can define positioning of an element in CSS as static which does not renders the element in any special way, but in a normal way. Elements with positioning as static are not affected by any of the CSS Positioning properties (left, right, top and bottom).ExampleLet’s see an example of CSS Static Positioning Method − Live Demo p {    margin: 0; } div:first-child {    position: static;    background-color: orange;    text-align: center; } Demo text This is demo text wherein we are displaying an example for static positioning. OutputFollowing is the ... Read More

Splay in Virtual Tree in Data Structure

Arnab Chakraborty
Updated on 07-Jan-2020 12:18:21

205 Views

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

Difference Between CSS Display and Visibility

AmitDiwan
Updated on 07-Jan-2020 12:18:16

2K+ Views

We can hide or remove an element in a HTML document with CSS Visibility and CSS Display properties respectively. To the user, there might not seem any difference in using any of the two properties, but there is.CSS Display − none does not render the element on the document and thus not allocating it any space.CSS Visibility − hidden does renders the element on the document and even the space is allocated but it is not made visible to the user.ExampleLet’s see an example for CSS Display none − Live Demo CSS Display None form {    width:70%; ... Read More

Display None Using CSS

AmitDiwan
Updated on 07-Jan-2020 12:14:05

4K+ Views

CSS Display None helps developer to hide the element with display property set to none. For element whose display is set to none no boxes are generated for it and even its child elements which might have display set to values other than none.SyntaxFollowing is the syntax for CSS display none −Selector {    display: none; }ExampleLet’s see an example of CSS display none − Live Demo CSS Display None form {    width:70%;    margin: 0 auto;       text-align: center; } * {    padding: 2px;    margin:5px;    box-sizing: border-box; } input[type="button"] {   ... Read More

Advertisements