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 only nodes with keys less than the node's key.Th...
分类:
其他好文 时间:
2014-07-13 16:53:01
阅读次数:
189
///利用opencv提供的函数cvKMeans2()实现图像聚类
///////运行环境:VC6.0+opencv1.0
///////////////使用的时候,改变flag的初始值,即可实现对灰度图、彩色图基于色彩的聚类,以及根据位置和色彩对彩色图像聚类。
////////////////最后结果显示的时候请注意pResult 和pResult3
#include "cv.h...
分类:
其他好文 时间:
2014-07-13 16:35:15
阅读次数:
463
Gold Coins
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 20913
Accepted: 13098
Description
The king pays his loyal knight in gold coins. On the first day o...
分类:
其他好文 时间:
2014-07-13 20:45:45
阅读次数:
205
SharePoint首页隐藏掉左侧导航以后,如果要以树视图呈现网站地图也很简单。...
分类:
其他好文 时间:
2014-07-13 13:58:37
阅读次数:
225
Color Me Less
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 30146
Accepted: 14634
Description
A color reduction is a mapping from a set of discrete colors ...
分类:
其他好文 时间:
2014-07-13 17:21:01
阅读次数:
209
重新学习一遍,看到了这个问题:
描述一个运行时间为O(nlgn)的算法,使之能在给定一个由n个整数构成的集合S和另一个整数 X 时,判断出S中是否存在有两个其和刚好等于 X 的元素。
Solution:
(1)->对整个集合进行排序,可以用快排(含有小文件策略、三者取中策略),时间复杂度O(nlogn),形成一个数组A[n]。
->设定两个下标pBegin和pEnd,分别指向数组...
分类:
其他好文 时间:
2014-07-13 15:46:55
阅读次数:
197
竞争条件
两个或多个进程读写某些共享数据,而最后的结果取决于进程运行的精确时序,称为竞争条件。凡涉及到资源的共享时就容易发生这样的事情。解决的办法是设立临界区,让进程互斥地访问共享资源。一个好的避免竞争条件的方案,必须满足4个条件:
任何两个进程不能同时处于临界区。不应对CPU的速度和数量做任何假设。临界区外运行的进程不得阻塞其它进程。不得让进程无限期等待进入临界区。
忙...
分类:
其他好文 时间:
2014-07-13 15:52:18
阅读次数:
256
Snowflake Snow Snowflakes
Time Limit: 4000MS
Memory Limit: 65536K
Total Submissions: 30512
Accepted: 8024
Description
You may have heard that no two snowflakes are al...
分类:
其他好文 时间:
2014-07-13 13:45:20
阅读次数:
235
条件: 开发板上双网卡,其中一个是usb wifi,提供wifi路由功能。另一个网口可以上外网。
目标:普通PC/手机能够连此wifi路由,上外网。
1. Wifi AP
USB Wifi部分:勿用多言,此使用Realtek 8188 UC版本,这款Wifi的官方软件自带了驱动程序相应的应用软件。应该就是RTL8188C_8192C_USB_linux_v4.0.2_9000.2013...
分类:
其他好文 时间:
2014-07-13 17:22:17
阅读次数:
422
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 and the nodes have the same value.
/**
* Defin...
分类:
其他好文 时间:
2014-07-13 15:50:25
阅读次数:
158
Mayor's posters
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 39795
Accepted: 11552
Description
The citizens of Bytetown, AB, could not stand that the...
分类:
其他好文 时间:
2014-07-13 14:02:48
阅读次数:
266
前言
今天新买的Thinkpad E431到货了,500G硬盘72...
分类:
其他好文 时间:
2014-07-13 20:47:33
阅读次数:
218
本系列以V1.4.1为蓝本。
在此版本中,内存分配分为:普通和内存池两种。
本篇介绍普通的内存分配,所有的函数在文件mem.c(本小结介绍的是L496-L518)。
1. 声明变量
(1) 内存大小变量
mem_size_t ptr, ptr2; 声明两个16位的无符号整型变量。
...
分类:
其他好文 时间:
2014-07-13 16:39:22
阅读次数:
227