lib/HuffmanAllocator.js
function(array) {
    var length = array.length;

    array[0] += array[1];

    var headNode, tailNode, topNode, temp;
    for (headNode = 0, tailNode = 1, topNode = 2;
         tailNode < (length - 1);
         tailNode++) {
      if ((topNode >= length) || (array[headNode] < array[topNode])) {
        temp = array[headNode];
        array[headNode++] = tailNode;
      } else {
        temp = array[topNode++];
      }

      if ((topNode >= length) ||
          ((headNode < tailNode) && (array[headNode] < array[topNode]))) {
        temp += array[headNode];
        array[headNode++] = tailNode + length;
      } else {
        temp += array[topNode++];
      }

      array[tailNode] = temp;
    }
  }
function(array) {
    var length = array.length;

    array[0] += array[1];

    var headNode, tailNode, topNode, temp;
    for (headNode = 0, tailNode = 1, topNode = 2;
         tailNode < (length - 1);
         tailNode++) {
      if ((topNode >= length) || (array[headNode] < array[topNode])) {
        temp = array[headNode];
        array[headNode++] = tailNode;
      } else {
        temp = array[topNode++];
      }

      if ((topNode >= length) ||
          ((headNode < tailNode) && (array[headNode] < array[topNode]))) {
        temp += array[headNode];
        array[headNode++] = tailNode + length;
      } else {
        temp += array[topNode++];
      }

      array[tailNode] = temp;
    }
  }
function ( array ) { var length = array . length ; array [ 0 ] += array [ 1 ] ; var headNode , tailNode , topNode , temp ; for ( headNode = 0 , tailNode = 1 , topNode = 2 ; tailNode < ( length - 1 ) ; tailNode ++ ) { if ( ( topNode >= length ) || ( array [ headNode ] < array [ topNode ] ) ) { temp = array [ headNode ] ; array [ headNode ++ ] = tailNode ; } else { temp = array [ topNode ++ ] ; } if ( ( topNode >= length ) || ( ( headNode < tailNode ) && ( array [ headNode ] < array [ topNode ] ) ) ) { temp += array [ headNode ] ; array [ headNode ++ ] = tailNode + length ; } else { temp += array [ topNode ++ ] ; } array [ tailNode ] = temp ; } }
Fills the code array with extended parent pointers
@param array The code length array
Fills the code array with extended parent pointers