Как исправить ошибку сегментации - PullRequest
0 голосов
/ 13 июня 2019

Я ищу самое высокое поддерево в данном 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; 
}
...