11902 - Matrix to Tree Converter (CS2351)
|
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
- Given
- A matrix of digits
- A starting non-zero digit
- A traversal method
- Task
- Convert the nonzero digits of the path in 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
width < 100 and height <100
Traversal method can be one of the following:
- "Level-order-traversal"
- "Pre-order-traversal"
- "Post-order-traversal"
Output
print out the tree traversal
There is an white space between each elements.
Tags