主要问题是math.h这个头文件虽然在/lib/include下有定义,但是该文件内并没有sqrt()的定义。解决的办法是;在编译的时候在后面加上-lm,意思是链接到math函数库。在gcc下用到数学函数,如sqrt。在gcc时要加上-lm参数,这样告诉编译器我要用到数学函数了 。如:gcc a.c...
分类:
其他好文 时间:
2014-06-18 18:26:23
阅读次数:
175
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...
分类:
其他好文 时间:
2014-06-18 17:32:02
阅读次数:
168
一. 准备依赖库安装make:yum -y install gcc automake autoconf libtool make安装g++:yum install gcc gcc-c++二. 编译安装pcrepcre 是一个正则表达式的库,编译nginx需要依赖该库实现url rewrite下载源码...
分类:
Web程序 时间:
2014-06-18 15:18:33
阅读次数:
231
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:
其他好文 时间:
2014-06-18 13:29:31
阅读次数:
214
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 le...
分类:
其他好文 时间:
2014-06-18 12:51:52
阅读次数:
205
二叉树的插入与删除,来自Mark Allen Weiss的《数据结构与算法分析》。# Definition for a binary tree nodeclass TreeNode: def __init__(self, x): self.val = x self...
分类:
编程语言 时间:
2014-06-17 14:25:01
阅读次数:
291
简单来说,就是二叉树的前序、中序、后序遍历,包括了递归和非递归的方法前序遍历(注释中的为递归版本): 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 struct TreeNode 9 {1...
分类:
其他好文 时间:
2014-06-17 12:53:42
阅读次数:
416
动态库*.so在linux下用c和c++编程时经常会碰到,最近在网站找了几篇文章介绍动态库的编译和链接,总算搞懂了这个之前一直不太了解得东东,这里做个笔记,也为其它正为动态库链接库而苦恼的兄弟们提供一点帮助。1、动态库的编译下面通过一个例子来介绍如何生成一个动态库。这里有一个头文件:so_test....
分类:
系统相关 时间:
2014-06-17 06:00:20
阅读次数:
522
二叉查找树(Binary Search Tree),也称二叉排序树(binary sorted tree),是指一棵空树或者具有下列性质的二叉树:若任意节点的左子树不空,则左子树上所有结点的值均小于它的根结点的值任意节点的右子树不空,则右子树上所有结点的值均大于它的根结点的值任意节点的左、右子树也分...
分类:
其他好文 时间:
2014-06-16 23:32:04
阅读次数:
199
最近公司的IIS服务器总是宕机,自己对运维知识又很欠缺,听了一些介绍决定硬着头皮上,架设一个haproxy负载到后端两个IIS.这里总结一下经验吧!首先用yum命令安装haproxy这个很简单,说一下流程吧!先安装gcc编译器#yuminstallgcc#wgethttp://haproxy.1wt.eu/download/1.4/src/..
分类:
系统相关 时间:
2014-06-16 16:41:06
阅读次数:
485