2015年4月18日

141. Linked List Cycle

摘要: Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Cracking Interview书上原题,快慢指针,如果有环肯定相遇。/** *... 阅读全文

posted @ 2015-04-18 08:14 shini 阅读(106) 评论(0) 推荐(0) 编辑

142. Linked List Cycle II

摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?Cra... 阅读全文

posted @ 2015-04-18 08:11 shini 阅读(102) 评论(0) 推荐(0) 编辑

143. Reorder List

摘要: Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For exam... 阅读全文

posted @ 2015-04-18 08:06 shini 阅读(80) 评论(0) 推荐(0) 编辑

94. Binary Tree Inorder Traversal

摘要: Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note... 阅读全文

posted @ 2015-04-18 07:18 shini 阅读(84) 评论(0) 推荐(0) 编辑

144. Binary Tree Preorder Traversal

摘要: Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].先pu... 阅读全文

posted @ 2015-04-18 06:55 shini 阅读(88) 评论(0) 推荐(0) 编辑

145. Binary Tree Postorder Traversal

摘要: Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].No... 阅读全文

posted @ 2015-04-18 06:39 shini 阅读(131) 评论(0) 推荐(0) 编辑

导航