title: Implementing a squarified treemap in javascript
body: <p>I'm currently trying to implement a treemap algorithm in Javascript. More specifically the algorithm described in <a href="http://www.win.tue.nl/~vanwijk/stm.pdf" rel="noreferrer">Squarified Treemaps</a>. The pseudo code given looks like the following:</p>
  
  <pre><code>procedure squarify(list of real children, list of real row, real w)
  begin
      real c = head(children);
      if worst(row, w) &lt;= worst(row++[c], w) then
          squarify(tail(children),row++[c], w)
      else
          layoutrow(row);
          squarify(children,[], width());
      fi
  end
  </code></pre>
  
  <p>however my JavaScript looks like:</p>
  
  <pre><code>var c = children[0];
  if (worst(row, w) &gt;= worst(row.concat(c), w)) {
      this.squarify(children.splice(1), row.concat(c), w);
  } else {
      layoutrow(row);
      this.squarify(children, [], width());
  }
  </code></pre>
  
  <p>As far as I can tell my code works correctly, but the inequality is the wrong way around. I'm assuming I'm overlooking something in my implementation, or is the inequality the wrong way around in the pseudo code? Thanks</p>