反轉二叉樹(二叉樹的鏡像)

    輸入一個二叉樹,輸出其鏡像。java     以下圖,即交換全部節點的左右子樹。 node     這裏提供兩種思路:使用遞歸和不使用遞歸。測試     使用的二叉樹定義以下:this public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; publ
相關文章
相關標籤/搜索