辗转相除,又名欧几里德算法(Euclidean
algorithm)乃求两个正整数之最大公约数的算法。此处用函数的递归调用编写了一个小程序:int gcd(int a,int b){ if(a%b==0)
return b; else return gcd(b,a%b)...
分类:
其他好文 时间:
2014-05-14 10:20:27
阅读次数:
241
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
Same Tree
Total Accepted: 15922 Total
Submissions: 38418
Given two binary trees, write a function to check if they are equal o...
分类:
其他好文 时间:
2014-05-14 01:15:40
阅读次数:
293
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
Symmetric Tree
Total Accepted: 13991 Total
Submissions: 44240
Given a binary tree, check whether it is a mirror of itself ...
分类:
其他好文 时间:
2014-05-14 00:52:07
阅读次数:
372
If you runfsck, the filesystem check and repair
command, it might find data fragments that are not referenced anywhere in the
filesystem. In particula...
分类:
其他好文 时间:
2014-05-13 16:59:54
阅读次数:
276
原题:
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and sell one share of th...
分类:
其他好文 时间:
2014-05-13 14:12:41
阅读次数:
342
Given an array, for example, 246135, an inversion pair is the pair whose first value is larger than its second value according to the sequence from left to right, (2,1) (4,1) (4,3) (6,1) (6,3) (6,5)....
分类:
其他好文 时间:
2014-05-13 08:03:58
阅读次数:
338
#!/bin/bash
#checkmysqlslavestatus
USER="check"
PSW="***"
RUNTIME=3600
ADDR="192.168.*.*"
declare-aslave_is
forIPin$ADDR
do
slave_is=($(/usr/local/mysql/bin/mysql-h$IP-u${USER}-p${PSW}-e"showslavestatus\G"|grepRunning|awk‘{print$2}‘))
if["${slave_is[0]}"="Y..
分类:
数据库 时间:
2014-05-13 04:33:44
阅读次数:
374
安全哈希算法(Secure Hash Algorithm)主要适用于数字签名标准 (Digital Signature Standard DSS)里面定义的数字签名算法(Digital Signature Algorithm DSA)。对于长度小于2^64位的消息,SHA1会产生一个160位的消息摘要。当接收到消息的时候,这个消息摘要可以用来验证数据的完整性。在传输的过程中,数据很可能会发生变化,...
分类:
编程语言 时间:
2014-05-12 22:52:43
阅读次数:
582
这是一个关于Posix线程编程的专栏。在阐明概念的基础上,本节将向您详细讲述Posix线程库API及创建、结束线程。...
分类:
编程语言 时间:
2014-05-11 21:11:01
阅读次数:
492
面向对象编程--定义基类和派生类[续]四、virtual与其他成员函数 C++中的函数调用默认不使用动态绑定。要触发动态绑定,必须满足两个条件: 1)只有指定为虚函数的成员函数才能进行动态绑定,成员函数默认为非虚函数,非虚函数不进行动态绑定。 2)必须通过基类类型的引用或指针进行函数调用。1、从派生类到基类的转换 因为每个派生类对象都包含基类部分,所以可以将基类类型的引用绑定到派生类对象的基类部分...
分类:
编程语言 时间:
2014-05-11 19:58:04
阅读次数:
431