11901 - Matrix to Tree Converter
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
| Case 6 |
1 sec |
32 MB |
| Case 7 |
1 sec |
32 MB |
| Case 8 |
1 sec |
32 MB |
| Case 9 |
1 sec |
32 MB |
| Case 10 |
1 sec |
32 MB |
Description
測資說明:
測資 1 就是 sample input/output
測資 2、5 只會要求算 level-order
測資 3、6 只會要求算 pre-order
測資 4、7 只會要求算 post-order
測資 8、9 會混合三種 traversal methods、且 matrix 最大 (100*100 內)
測資 10 測試一些比較極端的情形

- Given
- A matrix of digits
- A starting non-zero digit
- A traversal method
- Task
- Convert all the nonzero digits of the matrix into a tree
- Print out the digits according to one of the following tree traversal methods
- Level-order-traversal
- Pre-order-traversal
- Post-order-traversal
- Example

Input

Traversal method can be one of the following:
- "Level-order-traversal"
- "Pre-order-traversal"
- "Post-order-traversal"
Output
Repeat the inputs and additionally print out the tree traversal
Tags