Node* creatBTree(int *pArray, int startPos, int endPos)
{
if (endPos < startPos)
{
return NULL;
}
if (startPos == endPos)
{
Node* pNode = new Node(pArray[startPos]);
pNode->leftChild = NULL;
pNode->rightChild = NULL;
return pNode;
}
int middle = (startPos+endPos)/2;
Node* pNode = new Node(pArray[middle]);
pNode->leftChild = createBTree(pArray, startPos, middle-1);
pNode->rightChild = createBTree(pArray, middle+1, endPos),
return pNode;
}