code: function partition(left, right)
      {
        var pivot = map.values[ Math.floor((right + left) / 2) ];
        var i = left;
        var j = right;
  
        while (i <= j)
        {
          while (comparator( map.values[i], pivot ) < 0)
          {
            i++;
          }
          while (comparator( map.values[j], pivot ) > 0)
          {
            j--;
          }
  
          if (i <= j)
          {
            swap( map.values, i, j );
            swap( map.keys, i, j );
            i++;
            j--;
          }
        }
  
        return i;
      }
docs: Sort this partition!