上一页 1 2 3 4 5 6 7 ··· 16 下一页
  2011年10月6日
摘要: 1: #include <iostream> 2: #include <fstream> 3: using namespace std; 4: 5: int main(){ 6: ofstream out; 7: out.open("i://t.tx... 阅读全文
posted @ 2011-10-06 00:01 yangyh 阅读(1304) 评论(0) 推荐(0)
  2011年10月3日
摘要: 浮点数默认为双精度(double),除非指定F 至于为什么在打印单精度浮点数时要转换成双精度不太清楚 总的来说,在打印一个浮点数时,一.浮点数转换成双精度 二. 打印低32位. 1. printf(“%d”,5.1F);调用这句代码时发生了什么? 单精度浮点数:5.1F = 101.000110011001100110011..(有效位写满23位) = 1.010001100110... 阅读全文
posted @ 2011-10-03 19:11 yangyh 阅读(5971) 评论(0) 推荐(1)
  2011年9月29日
摘要: 1.二叉树按层遍历2.二叉树添加兄弟指针3.在二叉树中查找LCA(最近公共祖先)3.在排序二叉树中找到大于N且最接近N的数// PrintByLevel.cpp : Defines the entry point for the console application.// Author : yangyh#include "stdafx.h"#include <iostream>#include <queue>using namespace std;typedef struct _node_st{ int value; _node_st* pLeft 阅读全文
posted @ 2011-09-29 21:03 yangyh 阅读(1235) 评论(0) 推荐(1)
摘要: #ifndef Max(x,y)#define Max(x,y) (__extension__({typeof(x) __X=(x);typeof(y) __Y=(y);__X>__Y?__X:__Y;}))#endif 顺便问一下标准C下如何安全地定义呢? 阅读全文
posted @ 2011-09-29 11:38 yangyh 阅读(863) 评论(0) 推荐(0)
  2011年9月18日
摘要: 1.从未知的大量数中随机抽取一个数 解决:假设这个数为choice, 则对于第i个数,以1/i的概率替换它 choice = 1 以1/2的概率替换choice=2 以1/3的概率替换choice=3 … 直到数据遍历完毕 2.从未知的大量数中抽取出k个 解决:以k/i的概率让第i个数加入抽样集合,如果抽样集合已满,随机替换掉一个 假如要抽取10个 则1,2,3……10为初始化... 阅读全文
posted @ 2011-09-18 20:47 yangyh 阅读(469) 评论(0) 推荐(0)
  2011年9月4日
摘要: 0. 存在多种通道,key.channel()返回的是该事件的宿主,如果key是OP_ACCEPT事件,则返回的会是ServerSocketChannel.1. SelectionKey.cancel : cancel()方法是永久的注销SelectionKey.OPxxxx,并将其放入selector的canceled set中。在下一次调用select()方法的时候,这些键会从该选择器的所有键集中移除,它关联的信道也不在监听了(除非它又重新注册)。2.NIO HTTP Server Example :import java.io.*;import java.nio.*;import jav 阅读全文
posted @ 2011-09-04 00:57 yangyh 阅读(873) 评论(0) 推荐(0)
  2011年9月1日
摘要: 淘宝笔试题: 有N个蛋和M个篮子,把蛋放到M个篮子里,每个篮子都不能为空。另外,需要满足:任意一个小于N的正整数,都能由某几个篮子内蛋的数量相加的和得到。写出程序,使得输入一个(N,M),输出所有可能的分配情况 #include "StdAfx.h"#include <iostream>#include <math.h>using namespace std;#defin... 阅读全文
posted @ 2011-09-01 17:15 yangyh 阅读(541) 评论(0) 推荐(0)
  2011年8月24日
摘要: http://files.cnblogs.com/yangyh/jgchart_demo.rar <html><head><script src="jquery-1.3.2.min.js" type="text/javascript"></script><script src="jgcharts.js" type="text/javascript"></script></hea... 阅读全文
posted @ 2011-08-24 00:42 yangyh 阅读(584) 评论(0) 推荐(0)
  2011年8月23日
摘要: Tag: BigblueButton , 视频会议, WhiteBoard, deskShare,Red5 1.在red5下部署bigbluebutton,video,deskshare,sip等应用,其中bigbluebutton是必须的,并用red5的demo:echo_test测试其可用性,bigbluebutton在启动中会连接asterisk或freeswitch,如果你需要配置V... 阅读全文
posted @ 2011-08-23 20:19 yangyh 阅读(9681) 评论(0) 推荐(0)
  2011年8月17日
摘要: 百度实习生招聘笔试题: 请编写函数foo(int x, int y, int n) 计算:随机生成x个大小为[1,y]的正整数,它们的和为n的概率是多少? 解 :用一个数组count[m][k]表示共m次生成随机数,和为k的次数,初始化count[1][1],count[1][2]..count[1][y]=1 对于第i次产生随机数:和为i*min到i*max的和数j的概率(或称 次数)需要更改... 阅读全文
posted @ 2011-08-17 16:58 yangyh 阅读(759) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 16 下一页