Problem Description:Given a binary tree, flatten it to a linked list in-place.Solution:对二叉树进行前序遍历(pre-order). 1 public void flatten(TreeNode root) { 2...
分类:
其他好文 时间:
2014-07-07 18:47:24
阅读次数:
306
一般情况一句话即可:gcc -o fuck fuck.c./fuck 直接运行了问题1. 报错 ld 未找到此时,gcc编译得分布来,并且指定特定的ldgcc -c 1.c //会在目录下生成一个文件 1.o/usr/bin/ld -dynamic-linker /lib/ld-linux.so.....
分类:
其他好文 时间:
2014-07-07 17:25:09
阅读次数:
175
二叉树的后续遍历1、递归版本/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) :...
分类:
其他好文 时间:
2014-06-30 14:17:28
阅读次数:
306
践踏堆栈-缓冲区溢出漏洞
打算写这篇文章是因为在网上看过一篇论文,讲了缓冲区溢出破坏堆栈来执行恶意程序的漏洞。该论文请见参考资料1。这篇文章会涉及一些汇编的基础知识,以及虚拟内存的一些基本概念等。当然用来调试程序的系统是linux,工具是gcc。很久没有看过汇编和C语言了,错漏之处,还请指正。
1.概要
文章标题有提到堆栈和缓冲区,那么就先来探讨下这几个名词的定义。这里的缓冲区,指的就是计算...
分类:
其他好文 时间:
2014-06-30 10:22:25
阅读次数:
176
【题目】
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [3,2,1].
Note: Recursive solution is trivial, could you do it iteratively?
【题意】
非递归实现后续遍...
分类:
其他好文 时间:
2014-06-30 10:10:10
阅读次数:
177
【题目】
Given a binary tree, return the preorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,2,3].
Note: Recursive solution is trivial, could you do it iteratively?
【题意】
非递归返回先序遍历...
分类:
其他好文 时间:
2014-06-30 06:21:18
阅读次数:
334
快速排序算法 代码(C)本文地址: http://blog.csdn.net/caroline_wendy经典的快速排序算法, 作为一个编程者, 任何时候都要完整的手写.代码:/*
* main.cpp
*
* Created on: 2014.6.12
* Author: Spike
*/
/*eclipse cdt, gcc 4.8.1*/
#include
#in...
分类:
其他好文 时间:
2014-06-30 06:15:06
阅读次数:
225
字符串的排列 代码(C)本文地址: http://blog.csdn.net/caroline_wendy题目: 输入一个字符串, 打印出该字符串中字符的所有排列.方法: 使用递归依次交换位置, 打印输出.代码:/*
* main.cpp
*
* Created on: 2014.6.12
* Author: Spike
*/
/*eclipse cdt, gcc 4.8....
分类:
其他好文 时间:
2014-06-30 00:52:42
阅读次数:
247
Linux下Nginx的安装 如果出现:error: 'ngx_http_file_cache_node_t' has no member named 'length'异常,可能是ngx_cache_purge-2.1.tar.gz版本太旧导致...
分类:
系统相关 时间:
2014-06-30 00:11:43
阅读次数:
401
题目
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.
Below is one possible representation of s1 = "great":
great
/...
分类:
其他好文 时间:
2014-06-29 23:16:19
阅读次数:
312