摘要: Populating Next Right Pointers in Each Node IIOct 28 '12Follow 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 space.For example,Given the followin 阅读全文
posted @ 2013-02-17 17:16 西施豆腐渣 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Populating Next Right Pointers in Each NodeOct 28 '12Given 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 b... 阅读全文
posted @ 2013-02-17 17:00 西施豆腐渣 阅读(173) 评论(0) 推荐(0) 编辑
摘要: Sort ColorsApr 9 '12Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.Note:You are 阅读全文
posted @ 2013-02-17 14:29 西施豆腐渣 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Reverse Linked List IIJun 27 '12Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.Note:Givenm,nsatisfy the following condition:/** * Definition for singly-linked list. 阅读全文
posted @ 2013-02-17 10:35 西施豆腐渣 阅读(106) 评论(0) 推荐(0) 编辑