反正总是有人要赢,那为什么不能是我呢~[问题描述]Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.[...
分类:
其他好文 时间:
2014-08-15 14:14:58
阅读次数:
197
一步步写 CMOS 驱动模块
Let's implement a char driver to access the system CMOS.
首先仅仅是创建设备模块,最简单的,类似于前面hello world模块一样的东东,从最简单的框架慢慢搭
/*************************************************...
分类:
其他好文 时间:
2014-08-15 12:54:54
阅读次数:
302
库函数的运用。。。。
#include
#include
#include
int a[100000],b[100000];
void change(char *a)
{
int i,len;
len=strlen(a);
if (strstr(a,"."))
for(i=len-1;a[i]=='0';i--)
{
a[i]='\0...
分类:
其他好文 时间:
2014-08-14 20:51:19
阅读次数:
176
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )The above macro simply aligns the size ofnto the nearest greater-or-equa.....
分类:
其他好文 时间:
2014-08-14 20:11:19
阅读次数:
282
原题:
Implement pow(x, n).
思路:递归计算pow。
class Solution {
public:
double pow(double x, int n) {
long long int mid = n/2;
int d = n%2;
if(n==0) return 1;
if(n==1) return ...
分类:
其他好文 时间:
2014-08-14 16:54:38
阅读次数:
229
原题:
Implement int sqrt(int x).
Compute and return the square root of x.
==============================以下为引用====================================
牛顿迭代法
为了方便理解,就先以本题为例:
计算x2 = n的解,令f(...
分类:
其他好文 时间:
2014-08-14 16:51:18
阅读次数:
263
KMP的应用。直接使用s1产生next 数组,然后在s2中搜索s1,那么记录最后一个搜索到的数值,就是s1的前缀在s2中的最长后缀了。
本题应该不能直接调用strstr了吧。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
...
分类:
其他好文 时间:
2014-08-12 19:09:14
阅读次数:
192
Implement HashSet to store ‘n’ records of students ( Name, Percentage). Write a menu driven program to :1. Add student2. Display details of all studen...
分类:
其他好文 时间:
2014-08-11 21:03:22
阅读次数:
220
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the ...
分类:
其他好文 时间:
2014-08-11 10:01:01
阅读次数:
193
Describe how you could use a single array to implement three stacks.思路1:fixed divisionpackage Question3_1;import java.util.EmptyStackException;public ...
分类:
其他好文 时间:
2014-08-09 22:59:29
阅读次数:
401