原文:[LeetCode] Populating Next Right Pointers in Each Node II 每個節點的右向指針之二

Given a binary tree Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set toNULL. Initially, all next pointers are set toNULL. Exa ...

2015-02-13 13:51 12 14103 推薦指數:

查看詳情

leetcode-每個節點指針(填充同一層的兄弟節點

給定一個二叉樹 填充它的每個 next 指針,讓這個指針指向其下一個右側節點。如果找不到下一個右側節點,則將 next 指針設置為 NULL。 初始狀態下,所有 next 指針都被設置為 NULL。 說明: 你只能使用額外常數空間。 使用遞歸解題也符合要求,本題中遞歸程序占用 ...

Mon Aug 27 03:10:00 CST 2018 0 782
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM