Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL. Initially, al
Populating Next Right Pointers in Each Node II Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previous solution still work? Note: You may only use constant extra s
Given a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: 1 \ 2 \ 3 \ 4 \ 5 \ 6 click to show hints. Hints: If you notice carefully in the flattened tree, each node's right
好吧,今天晚上赶项目确实是做不了三道题目了,最近项目在网络编程方面有些进步,学到了东西,有时间再积累下来,很深的体会就是,和别人一起写代码,虽然蛋疼但是比自己一个人写要好点,不过发现自己对链表和排序什么的都不太熟练啊,得好好认真练习,加油! 6 LRU Cache public class LRUCache { private int capacity; private HashMap<Integer, Node> map; private Node firstNode; private No