資料結構實驗之二叉樹五 層序遍歷

2021-08-10 04:29:28 字數 778 閱讀 4659

time limit: 1000ms

memory limit: 65536kb

submit

statistic

problem description

已知乙個按先序輸入的字串行,如abd,,eg,,,cf,,,(其中,

表示空結點

)。請建立二叉樹並求二叉樹的層次遍歷序列。

input

輸入資料有多行,第一行是乙個整數

t (t<1000)

,代表有

t行測試資料。每行是乙個長度小於

50個字元的字串。

output

輸出二叉樹的層次遍歷序列。

example input

2

abd,,eg,,,cf,,,

xnl,,i,,u,,

example output

abcdefg

xnuli

#include#include#includeusing namespace std;

typedef struct bitnode

bitnode,*bitree;

char s[110];

int cnt;

void createbitree(bitree &t)

}void cxvisit(bitree t)

i++;

}}int main()

return 0;

}

資料結構實驗之二叉樹五 層序遍歷

time limit 1000ms memory limit 65536k 已知乙個按先序輸入的字串行,如abd,eg,cf,其中,表示空結點 請建立二叉樹並求二叉樹的層次遍歷序列。輸入資料有多行,第一行是乙個整數t t 1000 代表有 t行測試資料。每行是 乙個長度小於50 個字元的字串。輸出二...

資料結構實驗之二叉樹五 層序遍歷

time limit 1000ms memory limit 65536k 有疑問?點這裡 已知乙個按先序輸入的字串行,如abd,eg,cf,其中,表示空結點 請建立二叉樹並求二叉樹的層次遍歷序列。輸入資料有多行,第一行是乙個整數t t 1000 代表有 t行測試資料。每行是 乙個長度小於50 個字...

資料結構實驗之二叉樹五 層序遍歷

已知乙個按先序輸入的字串行,如abd,eg,cf,其中,表示空結點 請建立二叉樹並求二叉樹的層次遍歷序列。輸入資料有多行,第一行是乙個整數t t 1000 代表有 t行測試資料。每行是 乙個長度小於50 個字元的字串。輸出二叉樹的層次遍歷序列。2 abd,eg,cf,xnl,i,u,abcdefgx...