ITeye博客

2011 年文章归档

共 91 篇文章

Trie树、压缩Trie树、后缀树

http://hxraid.iteye.com/blog/618962 Trie树、压缩Trie树 http://hxraid.iteye.com/blog/620414 后缀树

2011-10-11 09:55 · 算法

子类重写父类的方法时声明抛出异常不能比父类范围大

http://hi.baidu.com/lurim/blog/item/4328f8398c91942eb8998faa.html

2011-10-09 23:29 · java基础

extern

http://www.diybl.com/course/3_program/c++/cppjs/200896/139666.html

2011-10-09 09:40 · c++

如何让new操作符不分配内存,只调用构造函数

http://blog.csdn.net/sws9999/article/details/3009779 placement new

2011-10-09 09:38 · c++

B-树的结构

http://student.zjzk.cn/course_ware/data_structure/web/chazhao/chazhao9.3.2.2.htm #define Max l000 //结点中关键字的最大数目:Max=m-1,m是B-树的阶 #define Min 500 //非根结点中关键字的最小数目:Min=┌m/2┐-1 typedef int KeyType; //KeyType应由用户定义 typedef struct node{ //结点定义中省略了指向关键字代表的记录的指针 int keynum; //结点中当前拥有的关键字的个数,keynum《Max KeyTy…

2011-10-08 22:29 · 算法

c++ 指针

#include<iostream> using namespace std; void swap1(int a, int b){//a,b只是一份拷贝。值传递 int temp = a; a = b; b = temp; } void swap2(int *a, int *b){//a,b是指向外部变量的指针。指针传递 int temp = *a; *a = *b; *b = temp; } void swap3(int *a, int *b){//指针交换了,指针指向的内容没有交换 int *temp; temp = a; a = b; b = temp; } void swap4(in…

2011-09-28 18:53 · 2011找工作中

大数据量,海量数据 处理方法总结

大数据量的问题是很多面试笔试中经常出现的问题,比如baidu google 腾讯 这样的一些涉及到海量数据的公司经常会问到。 下面的方法是我对海量数据的处理方法进行了一个一般性的总结,当然这些方法可能并不能完全覆盖所有的问题,但是这样的一些方法也基本可以处理绝大多数遇到的问题。 下面的一些问题基本直接来源于公司的面试笔试题目,方法不一定最优,如果你有更好的处理方法,欢迎与我讨论。 问题解答:http://www.uml.org.cn/zjjs/201109061.asp 1.Bloom filter 适用范围 :可以用来实现数据字典,进行数据的判重,或者集合求交集 http://blog.c…

2011-09-15 16:38 · 20110408实习

讲的很详细很透彻的多态性

http://zhidao.baidu.com/question/101623530.html Animal a = new Cat(); 这代表什么意思呢? 很简单,它表示我定义了一个Animal类型的引用,指向新建的Cat类型的对象。由于Cat是继承自它的父类Animal,所以Animal类型的引用是可以指向Cat类型的对象的。那么这样做有什么意义呢?因为子类是对父类的一个改进和扩充,所以一般子类在功能上较父类更强大,属性较父类更独特, 对于多态,可以总结它为: 一、使用父类类型的引用指向子类的对象; 二、该引用只能调用父类中定义的方法和变量; 三、如果子类中重写了父类中的一个方法,那么…

2011-09-08 11:10 · 20110408实习

qsort应用于指针数组与二维数组(字符)的差异

http://www.cppblog.com/Joe/archive/2010/10/29/131746.aspx?opt=admin

2011-09-03 15:37 · 20110408实习

c++位运算与类型字节数

http://www.cnblogs.com/thujason/archive/2010/07/08/1773529.html http://blog.sina.com.cn/s/blog_6cabbdcd0100pu56.html 查看机器上char、int等占的位数 sizeof(char) sizeof(int)

2011-09-02 23:51 · 20110408实习

struct和typedef struct

http://www.kuqin.com/language/20090406/44443.html 关键: 1 首先: 在C中定义一个结构体类型要用typedef: typedef struct Student { int a; }Stu; 于是在声明变量的时候就可:Stu stu1; 如果没有typedef就必须用struct Student stu1;来声明 这里的Stu实际上就是struct Student的别名。 另外这里也可以不写Student(于是也不能struct Student stu1;了) typedef struct { int a; }Stu; 但在c++里很简单,直…

2011-08-26 13:58 · 20110408实习

shell sed一次简单的应用

#!/bin/bash for i in 12 14 16 18 20 do sed -i 's,<stringProp name="ThreadGroup.num_threads">(('$i')-2)</stringProp>,<stringProp name="ThreadGroup.num_threads">'$i'</stringProp>,' spu_as.jmx ./jmeter.sh -n -t spu_as.jmx mv spu_as_id.log result_spu_as_id/spu_as_id.log.$i cd result_spu_as_id ./jtlPars…

2011-08-25 11:42 · 20110408实习

c++关键字explicit使用指南

http://tech.e800.com.cn/articles/2009/713/1247452155502_1.html explicit作用: 在C++中,explicit关键字用来修饰类的构造函数,被修饰的构造函数的类,不能发生相应的隐式类型转换,只能以显示的方式进行类型转换。 例子: 未加explicit时的隐式类型转换 1. class Circle 2. { 3. public: 4. Circle(double r) : R(r) {} 5. Circle(int x, int y = 0) : X(x), Y(y) {} 6. Circle(const Circle& c)…

2011-08-24 16:12 · 20110408实习

简介 const 与 static 的全部用法

http://blog.csdn.net/newstudent_never/article/details/6381675 const,先说变量 const int A; 常量 const int* pA; 指向常量的指针。 (*pA)++ 错误,不允许改变常量, 但是 pA = &D 可以改变指向的对象。与int* const pA等价 int const *pA; 常量指针,指向int。(*pA)++ 允许, 但不可以改变指向,既 pA = &D 错误。 与const int *pA等价 函数 const int a(); 返回常量 int const * a(); 返回常量指针 con…

2011-08-24 16:04 · 20110408实习

gtest小试 第一个makefile

gtest编译: http://www.linuxidc.com/Linux/2011-08/40946.htm gtest将就着的一个流程 http://blog.163.com/xychenbaihu@yeah/blog/static/1322296552011357338290/ gtest自带了个makefile只能编译一个文件,要make其他的每次都要改,改了下,可以编译所有(注意路径) GTEST_DIR = /home/andy/tools/gtest-1.5.0 SRC_CPP = $(wildcard /home/andy/gtest/src/*.cpp) SRC_H = …

2011-08-22 19:04 · 20110408实习

c++文件按行拆分

void splitFile() { int filelinenum=FILELINE/MAX; ifstream ifs("./test.txt"); string str; int num=1; int i=1; for(i=1;i<=MAX;i++) { strstream aa; aa<<(i-1); string strCount; aa>>strCount; string filepath = "./test"+strCount+".txt"; ofstream ofs(filepath.c_str()); int start = filelinenum*(i-1)+1; int…

2011-08-18 13:58 · 20110408实习

GCC出现warning: integer constant is too large for 'long' type"

The warning message can be safely ignored, as mb-gcc is not doing anything wrong; the 64-bit computing is in fact correct. This warning occurs because gcc is strict in syntax and requires LL on the end of such constants. This warning message disappears if the integer is appended with LL. long long …

2011-08-15 02:07 · 20110408实习

第一个c多线程

#include <stdio.h> #include <pthread.h> #include <sys/time.h> #define MAX 10 pthread_t thread[MAX]; pthread_mutex_t mut; long number=0; int i; void func() { int p=10000000; while(p--){} } void *thread_func() { pthread_mutex_lock(&mut); struct timeval tvStart,tvEnd; gettimeofday(&tvStart,NULL); func…

2011-08-15 02:06 · 20110408实习

time,gettimeofday,clock_gettime,_ftime

http://blog.csdn.net/sunlylorn/article/details/6313278 view plain copy to clipboard print ? _ftime()提供毫秒级的精确度 1、头文件 <sys/types.h> and <sys/timeb.h> 2、函数原型 void _ftime( struct _timeb *timeptr); 参数说明: struct _timeb { time_t time; unsigned short millitm; short timezone; short dstflag; }; #include <std…

2011-08-14 21:08 · 20110408实习

C++ Primer

2011.8.7 头文件通过inclue预处理器(通常捆绑在编译器中)指示符 而成为我们程序的一部分 #include指示符读入指定文件的内容,有两种格式: #include<some_file.h>: 表明这个文件是一个工程文件或标准头文件,查找过程会检查预定义的目录 #include"some_file.h": 表明该文件是用户提供的头文件,查找该文件时从当前目录开始 #ifndef #endif 检查预编译器常量在前面是否已经被定义 #ifdef #endif 指示符判断一个预处理器常量是否已定义, 以便有条件地包含程序代码 编译c++程序时,编译器自动定义了一个预处理器名字__cpl…

2011-08-07 14:35 · 20110408实习