private boolean nonDfsOrderDetected(int parentId, int childId) {
    return parentId >= 0 && childId != parentId + 1 && getChildrenCount(parentId) == 0;
  }
private boolean nonDfsOrderDetected(int parentId, int childId)