iteration

//前序遍历
#include<stdio.h>
#define SIZE 8
char Tree[SIZE] = {0, 'A' ,'B','C','D','E','F','G'};

void preOrder(int root)
{
    if(root * 2 >= SIZE)
    {
        printf("%c",Tree[root]);
        return;
    }
    printf("%c",Tree[root]);
    preOrder(root * 2);
    preOrder(root * 2 + 1);
}


int main(void)
{
    preOrder(1);
    return 0;
}
原文地址:https://www.cnblogs.com/xcsllll/p/6656220.html