很容易想到递归,实现确实不是太容易,对本人来说。
平衡二叉树是有序的,要求链表也是有序。
代码:
#include
//平衡二叉树转化为双向链表
using namespace std;
typedef struct tree{
int data;
struct tree *lchild;
struct tree *rchild;
}Tree,*pTree;
void...
分类:
其他好文 时间:
2014-08-12 13:37:24
阅读次数:
189
题目一:Populating
Next Right Pointers in Each Node
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Popul...
分类:
其他好文 时间:
2014-08-12 09:03:43
阅读次数:
201
翻译说明:这是一个日本人写的用户态下的函数tracer, 我们知道系统调用可以用strace, 库调用可以使用ltrace, 但是linux下竟然没有一个比较有名的用户程序的tracer, 这真是比较奇怪。目前这个工具只支持x86架构,arm之类的嵌入式环境不支持。以后有时候自己写一个tracer。
原文来自: http://binary.nahi.to/hogetrace/
trac...
分类:
其他好文 时间:
2014-08-12 00:45:23
阅读次数:
500
#include #include ...boost::property_tree::ptree pt;boost::property_tree::ini_parser::read_ini("config.ini", pt);std::cout ("Section1.Value1") ("Secti...
分类:
其他好文 时间:
2014-08-12 00:37:43
阅读次数:
184
boost::property_tree读取解析ini文件[cpp]view plaincopy#include"stdafx.h"#include#include#includeintmain(){boost::property_tree::ptreept;boost::property_tree...
分类:
其他好文 时间:
2014-08-12 00:32:43
阅读次数:
293
boost::property_tree读取解析.xml文件1)read_xml 支持中文路径 boost::property_tree::wptree wpt; std::locale::global(std::locale("")); boost::property_tree::xml_pars...
分类:
其他好文 时间:
2014-08-12 00:32:33
阅读次数:
400
property_tree是专为配置文件而写,支持xml,ini和json格式文件ini比较简单,适合简单的配置,通常可能需要保存数组,这时xml是个不错的选择。使用property_tree也很简单,boost自带的帮助中有个5分钟指南http://www.boost.org/doc/libs/1...
分类:
其他好文 时间:
2014-08-12 00:20:43
阅读次数:
264
boost 官网http://www.boost.org/下载页面http://sourceforge.net/projects/boost/files/boost/1.53.0/我下载的是boost_1_53_0.tar.gz使用系统 ubuntu 12.10一、解压[plain]view pla...
分类:
编程语言 时间:
2014-08-12 00:18:23
阅读次数:
1607
先上题目:Binary Search Heap ConstructionTime Limit:5 Seconds Memory Limit:32768 KBRead the statement of problem G for the definitions concerning trees. In...
分类:
其他好文 时间:
2014-08-11 23:57:23
阅读次数:
895
UVA 10228 - Star not a Tree?
题目链接
题意:给定一些点,费马点(到这些点距离和最短),输出距离和
思路:模拟退火去搞,初始温度1W步,降温系数设为0.83,然后每次找周围4个方向,做10次保证答案准确
代码:
#include
#include
#include
#include
#include
#include
using...
分类:
其他好文 时间:
2014-08-11 21:28:23
阅读次数:
415