随笔分类 -  cpp刷Leetcode

上一页 1 2 3 4 5 6 7 8 下一页

第一遍刷完leetcode,过程非常纠结。 第二遍再过leetcode,看看自己能记得多少,顺便加深印象。
【Maximum Depth of Binary Tree 】cpp
摘要:题目:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest... 阅读全文

posted @ 2015-05-16 23:09 承续缘 阅读(144) 评论(0) 推荐(0) 编辑

【Minimum Depth of Binary Tree】cpp
摘要:题目:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest... 阅读全文

posted @ 2015-05-16 21:53 承续缘 阅读(193) 评论(0) 推荐(0) 编辑

【Convert Sorted List to Binary Search Tree】cpp
摘要:题目:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.代码:/** * Definition for singly-linked ... 阅读全文

posted @ 2015-05-16 21:23 承续缘 阅读(161) 评论(0) 推荐(0) 编辑

【Convert Sorted Array to Binary Search Tree】cpp
摘要:题目:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.代码:/** * Definition for a binary tree node. * stru... 阅读全文

posted @ 2015-05-16 20:13 承续缘 阅读(194) 评论(0) 推荐(0) 编辑

【Validate Binary Search Tree】cpp
摘要:题目:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains onl... 阅读全文

posted @ 2015-05-16 18:15 承续缘 阅读(197) 评论(0) 推荐(0) 编辑

【Unique Binary Search Trees II】cpp
摘要:题目:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 ... 阅读全文

posted @ 2015-05-16 16:56 承续缘 阅读(214) 评论(0) 推荐(0) 编辑

【Unique Binary Search Trees】cpp
摘要:题目:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. ... 阅读全文

posted @ 2015-05-16 15:38 承续缘 阅读(222) 评论(0) 推荐(0) 编辑

【Construct Binary Tree from Inorder and Postorder Traversal】cpp
摘要:题目:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.代码:/** * De... 阅读全文

posted @ 2015-05-16 11:43 承续缘 阅读(153) 评论(0) 推荐(0) 编辑

【Construct Binary Tree from Preorder and Inorder Traversal】cpp
摘要:题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.代码:/** * Def... 阅读全文

posted @ 2015-05-16 11:14 承续缘 阅读(144) 评论(0) 推荐(0) 编辑

【Populating Next Right Pointers in Each Node II】cpp
摘要:题目: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 s... 阅读全文

posted @ 2015-05-15 11:41 承续缘 阅读(160) 评论(0) 推荐(0) 编辑

【Flatten Binary Tree to Linked List】cpp
摘要:题目:Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattene... 阅读全文

posted @ 2015-05-15 09:54 承续缘 阅读(195) 评论(0) 推荐(0) 编辑

【Same Tree】cpp
摘要:题目:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical... 阅读全文

posted @ 2015-05-15 08:39 承续缘 阅读(279) 评论(0) 推荐(0) 编辑

【Recover Binary Search Tree】cpp
摘要:题目:Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space ... 阅读全文

posted @ 2015-05-14 22:34 承续缘 阅读(269) 评论(0) 推荐(0) 编辑

【Binary Tree Zigzag Level Order Traversal】cpp
摘要:题目:Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and... 阅读全文

posted @ 2015-05-14 11:17 承续缘 阅读(166) 评论(0) 推荐(0) 编辑

【Binary Tree Level Order Traversal II 】cpp
摘要:题目:Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For ... 阅读全文

posted @ 2015-05-14 10:18 承续缘 阅读(143) 评论(0) 推荐(0) 编辑

【Binary Tree Level Order Traversal】cpp
摘要:题目:Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,... 阅读全文

posted @ 2015-05-14 09:59 承续缘 阅读(212) 评论(0) 推荐(0) 编辑

【Binary Tree Post order Traversal】cpp
摘要:题目:Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1]... 阅读全文

posted @ 2015-05-13 22:57 承续缘 阅读(291) 评论(0) 推荐(0) 编辑

【Binary Tree Inorder Traversal】cpp
摘要:题目:Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].N... 阅读全文

posted @ 2015-05-13 20:56 承续缘 阅读(249) 评论(0) 推荐(0) 编辑

【Binary Tree Preorder Traversal】cpp
摘要:题目:Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].... 阅读全文

posted @ 2015-05-13 20:00 承续缘 阅读(142) 评论(0) 推荐(0) 编辑

二叉树
摘要:刷题进入到二叉树这个章节,开篇随笔记录下二叉树相关的内容:二叉树的各种遍历和操作:http://blog.csdn.net/fansongy/article/details/6798278二叉搜索树(BST)的插入、查找、删除:http://segmentfault.com/a/1190000002... 阅读全文

posted @ 2015-05-13 19:32 承续缘 阅读(128) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 下一页

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示