114. Flatten Binary Tree to Linked List
1.問題
給予一個binary tree, 將他攤平成linked list (in-place)
2.想法
提問
確認題意: root是NULL是true或false?
function header, parameter
test input
說明想法
1.用pre-order traversal整個tree, 用指標調整: 將下個node放到right
測試計算複雜度
3.程式碼
pre-order traversal
Last updated