// returns the index of the newly created tree node
        private int CreateLeafNode(int startIdx, int endIdx, ILossFunction lossFunction)
        {
            // write a leaf node
            var val = lossFunction.LineSearch(originalY, curPred, internalIdx, startIdx, endIdx);

            tree[curTreeNodeIdx] = new RegressionTreeModel.TreeNode(RegressionTreeModel.TreeNode.NO_VARIABLE, val);

            EnqueuePartitionSplit(curTreeNodeIdx, startIdx, endIdx);
            curTreeNodeIdx++;
            return(curTreeNodeIdx - 1);
        }
    // returns the index of the newly created tree node
    private int CreateLeafNode(int startIdx, int endIdx, ILossFunction lossFunction) {
      // write a leaf node
      var val = lossFunction.LineSearch(originalY, curPred, internalIdx, startIdx, endIdx);
      tree[curTreeNodeIdx] = new RegressionTreeModel.TreeNode(RegressionTreeModel.TreeNode.NO_VARIABLE, val);

      EnqueuePartitionSplit(curTreeNodeIdx, startIdx, endIdx);
      curTreeNodeIdx++;
      return curTreeNodeIdx - 1;
    }