code: public static int bestRoot(long size, Transaction tx) {
  		int avail = tx.bufferMgr().available();
  		if (avail <= 1)
  			return 1;
  		int k = Integer.MAX_VALUE;
  		double i = 1.0;
  		while (k > avail) {
  			i++;
  			k = (int) Math.ceil(Math.pow(size, 1 / i));
  		}
  		return k;
  	}
docs: This method considers the various roots of the specified output size (in
  blocks), and returns the highest root that is less than the number of
  available buffers.
  
  @param size
  the size of the output file
  @param tx
  the tx to execute
  @return the highest number less than the number of available buffers,
  that is a root of the plan's output size