如何修复分割错误

时间:2019-06-12 23:38:12

标签: c queue binary-search-tree priority-queue

我正在寻找给定BST中的最高子树,以使其没有重复项。我写了代码,但是找不到问题。

pvertex Function(pvertex root, pNondupeSubtree* head) 
{ 
    int rear, front; 
    pvertex *queue = createQueue(&front, &rear); 
    pvertex temp_vertex = root; 


    while (temp_vertex) 
    { 
        if(AnyDupes(temp_vertex)){


            if (temp_vertex->left) 
                enQueue(queue, &rear, temp_vertex->left); 

            if (temp_vertex->right) 
                enQueue(queue, &rear, temp_vertex->right); 

            /*Dequeue vertex and make it temp_vertex*/
            temp_vertex = deQueue(queue, &front); 
        }
        else{
            int h = Height(temp_vertex);
            push(head, temp_vertex, h);
            temp_vertex = deQueue(queue, &front); 
        } 
    }
    return (*head)->root; 
}

0 个答案:

没有答案
相关问题