阿摩線上測驗
登入
首頁
>
研究所、轉學考(插大)◆資料結構與演算法
>
107年 - 107 國立臺北大學_碩士班一般入學考試試題_資訊工程學系:資料結構與演算法#147283
> 申論題
題組內容
2. (8%)
(A)將此 inorder statement : A(B+C)+EF-H/I 轉為 postorder,並畫出它的二元樹。
相關申論題
(B)設計一個算法使用 stack 來實現上述 inorder 轉 postorder,並且以上述 statement 說明如何使用 stack 來做轉換。
#605763
3. (8%)使用 linked list 實作 stack,運用以下 C 語言程式:typedef struct node { int value; node *next;}void push (node **top, int new_value) { // assume top is not nullnode new_node = (node ) malloc (sizeof (node));// (A) 實作以下敘述// add new_node to stack by top}int pop (node **top) { // assume top is not nullint value;node deleting_node = top;// (B) 實作以下敘述// remove the deleting node from stack, get the value of deleting nodefree(deleting_node);return value;}
#605764
4. (10%) 使用 queue 實作 level order traversal 轉換,運用以下 C 語言程式:void level_order (tree *root) { //assume root is not nullnode front, rear;//實作以下敘述// visit tree nodes based on level order by using queue// use queue by front, rear, enqueue(&rear, root), root =dequeue(&front)// print the values of tree nodes// describe the ending condition}
#605765
5. (16%) 使用 stack 實作 老鼠走過言問題 (Maze path search),運用 C 語言程式:void path(){ // assume int maze30 and offsets move[8] has been set in main function// typedef struct {int v; int h;} offsets;int i, row, col, nextrow, nextcol, dir, found = 0, top =0, mark30;typedef struct { int row; int col; int dir;} elementelement position, stack[100];mark1 = 1; stack[0].row = 1; stack[0].col = 1; stack[0].dir = 0;//實作以下敘述// Use stack to get current row, col, dir// Use dir to calculate nextrow, nextcol// Use nextrow, nextcol to check this move (1) arrive exit, or// (2) become a legal move; add this move into the stack, or// (3) check other dir}
#605766
相關試卷
115年 - 115 國立臺北大學_碩士班一般入學考試試題_資訊工程學系:資料結構與演算法#147260
115年 · #147260
114年 - 114 國立臺北大學_碩士班一般入學考試試題_資訊工程學系:資料結構與演算法#147250
114年 · #147250
113年 - 113 國立臺北大學_碩士班一般入學考試試題_資訊工程學系:資料結構與演算法#147281
113年 · #147281
112年 - 112 國立臺北大學_碩士班一般入學考試試題_資訊工程學系:資料結構與演算法#147280
112年 · #147280
111年 - 111 國立臺北大學_碩士班一般入學考試試題_資訊工程學系:資料結構與演算法#147272
111年 · #147272
110年 - 110 國立臺北大學_碩士班一般入學考試試題_資訊工程學系:資料結構與演算法#147276
110年 · #147276
110年 - [非官方正解]110 國立臺灣大學_碩士班招生考試_電信工程研究所丙組:資料結構與演算法(B)#113108
110年 · #113108
110年 - [非官方正解]110 國立中央大學_碩士班招生考試_資工類:資料結構與演算法#105890
110年 · #105890
109年 - 109 國立臺北大學_碩士班一般入學考試試題_資訊工程學系:資料結構與演算法#147273
109年 · #147273
109年 - 109 東吳大學_轉學生招生考試_資訊管理學系三年級︰資料結構#105850
109年 · #105850