
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 507 Articles for Algorithms

2K+ Views
Multivariate cross-sectional data (i.e. not time-series or repeated measure) are indicated by rectangular data in which each column is a variable (feature), and each row is a case or record.First procedure of representing rectangle data is to map it onto a higher-dimensional point data and use point-based data structure procedures such as the grid file, PR quadtree, point quadtree, and k-d-tree. Procedure mapping of the rectangular data to a four-dimensional point can be performed in number techniques such as x and y coordinates of the opposite corners, or x and y coordinates of one corner and the width and height, ... Read More

664 Views
Bucketing builds, the hash table as a 2D array instead of a single dimensional array. Every entry in the array is big, sufficient to hold M items (M is not amount of data. Just a constant).ProblemsLots of wasted space are created.If M is exceeded, another strategy will need to be implemented.Not so good performer for memory based implementations but doable if buckets are disk-based.For bucketing it is ok to have λ>1. However, the larger λ is the higher a chance of collision. λ>1 guarantees there will be minimum 1 collision (pigeon hole principle). That will enhance both the run time ... Read More

299 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

621 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

607 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

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

183 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

501 Views
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

180 Views
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

158 Views
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