标签:ret i++ == pre efi node class style oid
#include<stdio.h> #include<stdlib.h> #define maxSize 50 typedef struct Node{ int data[maxSize]; int n; }Sqbtree; void createSqbtree(Sqbtree &L,char pre[],int n, int &S){ char ch =pre[S++]; if(ch == ‘;‘) return ; if(ch != ‘#‘){ L.data[n] = ch; createSqbtree(L,pre,2*n+1,S); createSqbtree(L,pre,2*n+2,S); } } void printSqbtree(Sqbtree L,int n){ if(L.data[n] != ‘#‘){ printf("%c",L.data[n]); if(L.data[2*n+1] != ‘#‘ && L.data[2*n+2] != ‘#‘) printf("("); printSqbtree(L,2*n+1); if(L.data[n*2+2] != ‘#‘) printf(","); printSqbtree(L,2*n+2); if(L.data[2*n+1] != ‘#‘ && L.data[2*n+2] != ‘#‘) printf(")"); } } int main(){ Sqbtree L; int s=0,k=0; char ch[maxSize] = {‘a‘,‘b‘,‘c‘,‘#‘,‘#‘,‘e‘,‘#‘,‘#‘,‘f‘,‘g‘,‘#‘,‘#‘,‘h‘,‘#‘,‘#‘,‘;‘}; for(int i = 0;i < maxSize;i++){ L.data[i] = ‘#‘; } createSqbtree(L,ch,k,s); printSqbtree(L,k); }
标签:ret i++ == pre efi node class style oid
原文地址:https://www.cnblogs.com/L1Gd0ng/p/10970816.html