lzhenf

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2014年4月12日

摘要: 1 #ifndef _LIST_H__ 2 #define _LIST_H__ 3 #include 4 template class List; 5 6 7 template 8 class Link 9 { 10 friend class List; 11 12 private: 13 Type m_Data; 14 Link* m_Next; 15 Link* m_Pre; 16 Link(const Type& Val, Link* Next, Link* Pre); 17 18 }; 19 20 templ... 阅读全文
posted @ 2014-04-12 02:08 lzhenf 阅读(240) 评论(0) 推荐(0) 编辑

2013年8月18日

摘要: STL源码剖析第一章主要介绍的STL的历史由来和重要组成部分。STL有以下六大组件:1.容器(containers):各种数据结构,如vector,list,deque,set,map用来存储数据,从实现的角度来看,容器是一个class template,就体积而言,这一部分很像冰山在海面下的比率。2.算法(algorithm):各种算法如sort,search,copy,erase....等等, 从实现的角度来说,算法是一个function template。3.迭代器(iterator):扮演容器和算法之间的粘合剂,所谓的泛型指针,共有5种类型,以及他们的衍生变化,从实现的角度来看,迭代器 阅读全文
posted @ 2013-08-18 22:17 lzhenf 阅读(317) 评论(0) 推荐(0) 编辑

2012年4月11日

摘要: 程序代码参考了csdn某博客,具体名字忘记了变量命名的头文件//common.h#ifndef COMM_H#define COMM_H#include <iostream>#include <vector>#include <string>#include <algorithm>#include <iterator>using namespace std;typedef vector<string> StrVec; //字符串向量typedef vector<int> IntVec; //整数向量typede 阅读全文
posted @ 2012-04-11 16:04 lzhenf 阅读(2549) 评论(0) 推荐(0) 编辑

2012年4月5日

摘要: //ditionary.h#include <iostream>#include <string>#include <hash_map>#include <fstream>#include <sstream>using namespace std;class Cditionary{public: Cditionary(); ~Cditionary(); int FindWord(string w);private: string strtmp; string word; hash_map<string , int> wor 阅读全文
posted @ 2012-04-05 22:56 lzhenf 阅读(1097) 评论(0) 推荐(0) 编辑

2012年4月4日

摘要: #include <stdio.h>int arr[]= {3,8,11,92,34,12,7};int partition(int l , int r ){ int x = arr[r]; int temp; int i = l -1 ; for ( int j = l ; j < r ; j++) if ( arr[j] < x) { i++; temp = arr[j]; arr[j] = arr[i]; arr[i] = temp; ... 阅读全文
posted @ 2012-04-04 04:04 lzhenf 阅读(237) 评论(0) 推荐(0) 编辑

2012年4月3日

摘要: #include <stdio.h>#include <stdio.h>#include <iostream>using namespace std;class Base{ public: virtual void f(){cout <<"Base:f"<<endl;} virtual void g(){cout<<"Base:g"<<endl;} virtual void h(){cout<<"Base :h" <<endl; 阅读全文
posted @ 2012-04-03 23:56 lzhenf 阅读(344) 评论(1) 推荐(0) 编辑

2012年4月2日

摘要: 推荐引擎前面介绍了推荐引擎对于现在的 Web2.0 站点的重要意义,这一章我们将讲讲推荐引擎到底是怎么工作的。推荐引擎利用特殊的信息过滤技术,将不同的物品或内容推荐给可能对它们感兴趣的用户。图 1. 推荐引擎工作原理图 图 1 给出了推荐引擎的工作原理图,这里先将推荐引擎看作黑盒,它接受的输入是推荐的数据源,一般情况下,推荐引擎所需要的数据源包括:要推荐物品或内容的元数据,例如关键字,基因描述等;系统用户的基本信息,例如性别,年龄等用户对物品或者信息的偏好,根据应用本身的不同,可能包括用户对物品的评分,用户查看物品的记录,用户的购买记录等。其实这些用户的偏好信息可以分为两类:显式的用户反馈:这 阅读全文
posted @ 2012-04-02 21:24 lzhenf 阅读(320) 评论(0) 推荐(0) 编辑

2012年3月30日

摘要: #include <stdio.h>struct node{ int val; node* next;};typedef node* list_node;list_node create(int n ){ list_node head , temp ,pre; head = new node; pre = head; while ( n -- ) { temp = new node; scanf("%d" , &temp->val); pre->next = temp; pre = temp; ... 阅读全文
posted @ 2012-03-30 00:00 lzhenf 阅读(209) 评论(0) 推荐(0) 编辑

2012年3月28日

摘要: int binarysort(int begin , int end , int target){ if ( begin >end ) return -1 ; int middle = (begin + end ) >>1; if ( arr[middle ] == target ) return middle; else if ( target > arr[middle]) binarysort( middle +1 , end, target); else ... 阅读全文
posted @ 2012-03-28 15:39 lzhenf 阅读(156) 评论(0) 推荐(0) 编辑

2012年3月27日

摘要: /*********************** * author :lzhenf * it's a program with args for mutithread in linux OS * date:2012.3.27 * ***********************/#include <stdio.h>#include <pthread.h>void* mythread(void* args){ char *str1; str1 = (char *)args; sleep(5); printf("the thread id is %u&quo 阅读全文
posted @ 2012-03-27 15:47 lzhenf 阅读(185) 评论(0) 推荐(0) 编辑