Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.题意:知道二叉树的前序遍历和中...
分类:
其他好文 时间:
2014-09-29 23:47:51
阅读次数:
265
strings存在三种“大小”:1、size()和length() 返回string中现在的字符个数。上述两个函数等效。成员函数empty()用来检验字符数是否为0,亦即字符串是否为空。你应该优先使用该函数,因为它比length()或size()来得快。也就是说,使用if(s.empty()==tr...
分类:
其他好文 时间:
2014-09-29 00:15:16
阅读次数:
248
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Frameset//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
<title&..
分类:
其他好文 时间:
2014-09-28 02:16:31
阅读次数:
189
第一种方法是Morris Traversal
是O(n)时间复杂度,且不需要额外空间的方法。缺点是需要修改树。
通过将叶子节点的right指向其中序后继。
代码如下
vector inorderTraversal(TreeNode *root) {
vector res;
TreeNode * cur = root;
TreeNode...
分类:
其他好文 时间:
2014-09-27 22:46:50
阅读次数:
195
#includechar A[10];void inputElem(char &e){ scanf("%c",&e);}bool endValue(char &e){ if(e!='#') return false; else return tr...
分类:
其他好文 时间:
2014-09-26 22:53:58
阅读次数:
203
html代码: 1 2 3 4 5 6 删除 7 8 9 10 11 12 删除13 14 15 16 17 18 删除19 20 21 方法一:var trList = $("#history_income_list").children("tr") for (var i...
分类:
Web程序 时间:
2014-09-26 02:57:18
阅读次数:
271
在很多现实的场景中,有的文本框我们希望在选择“是”的按钮之后才出现,这就需要js控制TR的隐藏和显示,(div的影藏显示类似)以下是一段选择是的按钮就显示身高和体重的文本框的代码。注意:ready方法必须要引用jquery的库。1.html Code无标题文档是否填写身高体重身高体重2.Jquery...
分类:
Web程序 时间:
2014-09-26 01:13:48
阅读次数:
1182
什么是Xml?Xml是扩展标记语言的简写,是一种开发的文本格式。关于它的更多情况可以通过w3组织了解http://www.w3.org/TR/1998/REC-xml-19980210。如果你不知道它,那你就out太多了。.Net处理Xml相关随笔1.通过XmlDocument读写Xml文档2.通过...
分类:
Web程序 时间:
2014-09-25 12:19:19
阅读次数:
243
Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].思路...
分类:
其他好文 时间:
2014-09-24 22:57:37
阅读次数:
187