Follow

Translate

Friday, March 18, 2016

PATH LENGTH: HUFFMAN'S ALGORITHM


An extended binary tree or 2-tree is a binary tree T which each node has either 0 or 2 node children. The nodes with 0 children are called external nodes. and the nodes with 2 children are called internal code. A 2-tree where the internal nodes are denoted by circles and the external nodes are denoted by square. In any 2-tree, the number NE of external nodes is 1 more than the number N1 of internal nodes; that is,

NE = N1 + 1;

Example:           2-tree,  N1 = 6 and NE = N1 + 1 = 7

LE = 2+2+3+4+4+3+3    and    L1 = 0+1+1+2+3+2 = 9

Observe That L1 + 2n = 9+2.6 = 9+12 = 21 = LE

Where n = 6 is the number of internal nodes.  Formula  LE = L1
+ 2n

is true for any 2-tree with n internal nodes.
Suppose T is a 2-tree with n external nodes, and suppose each of the external nodes is assigned a weight.  The weighted path length P of the tree T is defined to be the sum of weighted path length ;  i.e,
                         P = W1L1 + W2L2 +..............+    WnLn

Where Wi and Li denote, respectively, the weight and path length of an external node Ni


If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

Related Posts:

  • (Matrix Multiplication) MATMUL(A, B, C, M, P, N) (Matrix Multiplication) MATMUL(A, B, C, M, P, N) Le A be an M * P matrix array, and let B be a P * N matrix array. This algorithm stores the product of A and B in an M * N matix array C. 1.  Repeat Steps 2 to 4 for I… Read More
  • Example Using the bubble sort algorithm Using the bubble sort algorithm, Algorithm 4.4, find the number C of comparisons and the number D of interchanges which alphabetize the n = 6 letters in PEOPLE. The sequence of pairs of letters which are compared in … Read More
  • Warshall's Algorithm (Warshall's Algorithm) A directed graph  G with M nodes is maintained in memory by its adjacency matrix A. This algorithm finds the (Boolean) path matrix P of the graph-G 1.  Repeat for I, J = 1, 2......, M: [In… Read More
  • Solve Math problem By Using Linear Arrays Solve Math problem By Using Linear Arrays: 4.1  Consider the linear arrays AAA(5:50), BBB(-5:10) and CCC(18). (a) Find the number of elements in each array. (b) Suppose Base(AAA) = 300 and W = 4 words per memory cel… Read More
  • Number Sorted Of Bubble Sort Suppose the following numbers are stored in an array A:                             … Read More

0 comments:

Post a Comment