- 博客(11)
- 收藏
- 关注
原创 KMP算法
#include#include#include#includeusing namespace std;void getNext(const char* str,int next[]){assert(str!=NULL&&next!=NULL);int i=1,j=0;int len=strlen(str);next[0]=0;next[1]=1;w
2014-09-06 13:05:02
262
原创 微软100题(第三题)
题目:输入一个整形数组,数组里有正数也有负数。求所有子数组的和的最大值,并且时间复杂度为O(n)个人代码:#includeusing namespace std;int main(){int length,sum=0,max=0;coutcin>>length;int *a=new int[100];for(int i=0;i!=length;+
2014-03-29 09:37:23
321
原创 微软100题(第十四题)
题目:输入一个已知按升序排列过的数组和一个数字,要求在数组查找两个数,使得它们的和正好是输入的那个数字,并且时间复杂度是O(n)个人代码:#includeusing namespace std;int main(){int find,length,beg=0;coutcin>>length;int *a=new int[100];fo
2014-03-28 19:05:24
269
原创 微软100题(第十三题)
题目:输入一个单向链表,输出该单向链表中倒数第K个结点,链表的倒数第0个结点为链表的尾指针个人代码:第一步:定义单向链表的结点,和链表LinkList结构体#includeusing namespace std;typedef struct Node{int data;Node *next;}Node;typedef struct Node *Lin
2014-03-28 16:48:06
275
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅