Hi, I have the structure and the insertion method of a btree, but I need to do the traversal method. I have this so far:

void inorden(btree r){  //inorder
    for (int i=0; i<=r->peso; i++){   //n+1 branches
        if (r->rama[i])  
            inorden(r->rama[i]);  

        if (i<=r->peso-1 && (r)->clave[i]) 
            printf(" %i", r->clave[i]);  
    }
}

The problem with this code is that I need to set the dot file to send it to graphviz, but I don't know how to set the relationship between each node if I have this recursive method. Could anyone please give me an algorithm to do the traversals for a btree?
thanks

See Knuth Vol. 3, Sorting and Searching.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.