lib/HuffmanAllocator.js
function(array, maximumLength) {
    var currentNode = array.length - 2;
    var currentDepth;
    for (currentDepth = 1;
         (currentDepth < (maximumLength - 1)) && (currentNode > 1);
         currentDepth++) {
      currentNode =  first (array, currentNode - 1, 0);
    }

    return currentNode;
  }
function(array, maximumLength) {
    var currentNode = array.length - 2;
    var currentDepth;
    for (currentDepth = 1;
         (currentDepth < (maximumLength - 1)) && (currentNode > 1);
         currentDepth++) {
      currentNode =  first (array, currentNode - 1, 0);
    }

    return currentNode;
  }
function ( array , maximumLength ) { var currentNode = array . length - 2 ; var currentDepth ; for ( currentDepth = 1 ; ( currentDepth < ( maximumLength - 1 ) ) && ( currentNode > 1 ) ; currentDepth ++ ) { currentNode = first ( array , currentNode - 1 , 0 ) ; } return currentNode ; }
Finds the number of nodes to relocate in order to achieve a given code
length limit
@param array The code length array
@param maximumLength The maximum bit length for the generated codes
@return The number of nodes to relocate
Finds the number of nodes to relocate in order to achieve a given code length limit