给我用C语言写一个二叉树的遍历

我可以给你一个例子: #include struct node { int data; struct node left, right; }; / function to print leaf nodes of a binary tree/ void printLeaves(struct node* root) { if ( root != NULL ) { printLeaves(root->left);

// 如果节点为叶子节点,则打印
    if ( root-

你可能感兴趣的:(c语言,c++,开发语言,算法)