- 博客(26)
- 资源 (2)
- 收藏
- 关注
原创 Packetdrill(网络协议测试工具)
最近参加一个内核项目,需要测试linux内核tcp/ip网络代码,最终选择google的开源工具packetdrill,网上搜索了packetdrill的资料有一些,但是并不是很多,结合自己使用过程中遇到的问题和心得写一篇packetdrill使用总结,总体上来说packetdrill工具很容易上手,但是使用过程还是遇到一些问题,总共分三部门,第一部分是packetdrill介绍,第二部分是pac...
2018-10-20 15:32:49
4991
1
原创 OpenGL-ES API学习理解
OpenGL® ES 3.2https://www.khronos.org/registry/OpenGL-Refpages/es3/void glGenBuffers(GLsizei n, GLuint * buffers)创建n个缓存对象,这n个缓存对象保存在数组buffers,每个buffer对象是一个int数字,当n小于0时,产生GL_INVALID_VALUE错误码。v...
2018-07-18 20:12:56
440
转载 南京IT公司总结
http://www.iteer.net/1.华为技术南京研究所地址:南京市白下路汇鸿大厦 网站:http://www.huawei.com2.趋势科技(中国)有限公司地址:南京市雨花台区软件大道48号苏豪国际广场B座3. 南京迅雷软件有限公司地址:南京高新区软件园动漫大厦C座8楼4.. 南京中兴软创科技股份有限公司地址:南京市江宁区正方中路888号 规模:
2013-10-29 18:16:08
18467
1
原创 一个台阶总共有n级,如果一次可以跳1级,也可以跳2级。 //求总共有多少总跳法,并分析算法的时间复杂度
#include using namespace std;//题目1:一个台阶总共有n级,如果一次可以跳1级,也可以跳2级。//求总共有多少总跳法,并分析算法的时间复杂度//递归的时间复杂度以n的指数增加int Fun1(int n){ if(n <= 0) return 0; if(1 == n) return 1; if(2 == n) return 2; e
2013-09-26 11:02:40
1529
原创 简单字符串四则运算
/*********************************************************3. 简单四则运算问题描述:输入一个只包含个位数字的简单四则运算表达式字符串,计算该表达式的值注1、表达式只含 +, -, *, / 四则运算符,不含括号2、表达式数值只包含个位整数(0-9),且不会出现0作为除数的情况3、要考虑加减乘除按通常四则运算规定
2013-08-07 16:24:49
760
原创 约瑟夫环问题
/*******************************************************************************约瑟夫环是一个数学的应用问题:已知n个人(以编号1,2,3...n分别表示)围坐在一张圆桌周围。从编号为k的人开始报数,数到m的那个人出列;他的下一个人又从1开始报数,数到m的那个人又出列;依此规律重复下去,直到圆桌周围的人全部出列
2013-08-07 14:22:05
628
原创 过滤字符串(若字符串中出现多个相同的字符,将非首次出现的字符过滤掉)
#include using namespace std;#include /*题目描述:通过键盘输入一串小写字母(a~z)组成的字符串。请编写一个字符串过滤程序,若字符串中出现多个相同的字符,将非首次出现的字符过滤掉。比如字符串“abacacde”过滤结果为“abcde”。要求实现函数: void stringFilter(const char *pI
2013-08-06 22:04:23
1528
原创 字符串压缩
#include using namespace std;/*题目描述:通过键盘输入一串小写字母(a~z)组成的字符串。请编写一个字符串压缩程序,将字符串中连续出席的重复字母进行压缩,并输出压缩后的字符串。压缩规则:1. 仅压缩连续重复出现的字符。比如字符串"abcbc"由于无连续重复字符,压缩后的字符串还是"abcbc".2. 压缩字段的格式为"字符重复的次数+字
2013-08-06 20:42:08
1186
原创 第一次只出现一次的字符
#include #include using namespace std;//第一次只出现一次的字符//input: abaccdeff//output: bchar FirstNotRepeatingChar1(char* pString);char FirstNotRepeatingChar2(char* str);int main(){ char* str = "a
2013-07-26 21:38:22
576
原创 数组中的逆序对
#include //#include using namespace std;//数组中的逆序对//input: {7, 5, 6, 4}//output: 5(分别是(7,5)、(7,6)、(7,4)、(5,4)、(6,4))//时间复杂度为O(n2)int InversePairs1(int* numbers, int length){ int count = 0;
2013-07-26 21:37:30
591
原创 两个链表的第一个公共节点
struct ListNode{ int data; struct ListNode* next;};//两个链表的第一个公共节点/********************************************************链表是单向链表,如果两个单向链表有公共结点,那么这两个链表从某一结点开始,他们的next都指向同一个结点。但由于单向链表的结点,每个结点只
2013-07-26 21:36:21
849
原创 判断一颗二叉树是否为平衡二叉树(AVL)
struct BinaryTreeNode{ int data; struct BinaryTreeNode* pleft; struct BinaryTreeNode* pright;};//二叉树深度int TreeDepth(BinaryTreeNode* root){ if(root == NULL) return 0; int left = TreeDepth(r
2013-07-26 21:35:25
849
原创 计算第1500个丑数
方法一:#include //从小到大第1500个丑数bool IsUgly(int num){ while(num%2 == 0) num /= 2; while(num%3 == 0) num /= 3; while(num%5 == 0) num /= 5; if(num == 1) return true; else return false;}
2013-07-26 12:17:21
1063
原创 把数组排成最小数
#include #include #include //#include const int g_MaxNumberLength = 10;char* g_StrCombine1 = new char[g_MaxNumberLength * 2 + 1];char* g_StrCombine2 = new char[g_MaxNumberLength * 2 + 1];int
2013-07-26 10:52:20
570
原创 判断输入数是否为回文数
bool judge(int m){ char str[20]; sprintf(str, "%d", m); int len = strlen(str); char* front = str; char* rear = str + len -1; while(front < rear) { if(*front == *rear) { front ++; rea
2013-07-24 22:39:58
575
翻译 singleton单例模式
//Singleton.hclass Singleton{ private: static Singleton* instance; Singleton(){} public: static Singleton* GetInstance();};Singleton* Singleton::GetInstance(){ if(instance == NULL) ins
2013-07-24 22:12:42
433
原创 统计1到N中1的个数,并找出满足飞fun(n)=n的最大n值
#include #include #include using namespace std;#include int fun(int N);int main(){for(unsigned int k=400000; k>1; k--){if(fun(k) == k){coutreturn 0;}}return 0;}//
2013-07-24 21:00:24
760
原创 寻找相同长度最长子串
#include #include #include using namespace std;#include int main(){string str,temp;coutcin>>str;int len = str.length();for(int i=len-1; i>1; i--){for(int j=0; j{if(i+
2013-07-24 15:01:32
639
原创 主字符串中查找子字符串
#include #include #include using namespace std;//string:12345678 substring:456//return:45678const char* _strstr(const char* string, const char* strCharSet){//har* p1 = string;
2013-07-24 12:47:56
847
原创 转换字符串格式,源字符串转换为字符串字符+连续出现次数
#include #include #include using namespace std;//转换字符串格式,源字符串转换为字符串字符+连续出现次数//input:1234456666//output:112131425164int main(){char str1[] = "1234456666";char str2[20];str2[0]
2013-07-24 10:53:03
530
原创 反转单词
#include using namespace std;void ReverseWord(char* pBegin, char* pEnd){ while(pBegin { char temp = *pBegin; *pBegin = *pEnd; *pEnd = temp; pBegin++; pEnd--; }} void
2013-07-23 19:59:07
485
原创 求一个字符串中连续出现次数最多的子串(程序面试宝典)
//求一个字符串中连续出现次数最多的子串/* Author: Mcdragon Date: 15-07-11 21:17 Description: 求一个字符串中连续出现次数最多的子串. 基本算法描述: 给出一个字符串abababa 1.穷举出所有的后缀子串 substrs[0] = abababa;
2013-07-23 19:04:20
1192
原创 字符串循环右移问题?
#include using namespace std;#include #include void Reverse(char *str, int m, int n){ char temp; char *front = str +m; char *rear = str + n; while(front { temp = *front; *fro
2013-07-23 16:53:39
597
原创 字符串拷贝(strcpy)
#include using namespace std;#include #include #include #include char* StrCpy(char* strDest, const char* strSrc){assert(strDest!=NULL && strSrc!=NULL);char *address = strDest
2013-07-23 12:58:28
507
原创 字符串转换为整数(atoi)
#include #include #include using namespace std;int atoi(char *str){int temp[64];int i = 0;int sum = 0;bool isNeg = false;if(*str == '-'){isNeg = true;str++;}while(*st
2013-07-23 10:54:33
499
原创 整数转换为字符串(itoa)第一稿
#include #include using namespace std;char* itoa(int num, char *arr){//char arr[64];int i = 0;while(num){arr[i++] = num % 10 + '0';//arr[i++] = num % 10 +'0';num = num/10;
2013-07-23 09:33:35
526
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人