上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页
摘要: /* * author:lx * breif: 2011.09.22 * brief: quick-sort */#include <stdio.h>#include <stdlib.h>voidquick_sort( int *x, int l, int u ){ if ( l >= u ) { return; } int m = l; int i; for ( i = l+1; i < u; i++ ) { if ( x[i] < x... 阅读全文
posted @ 2011-09-22 19:25 lxgeek 阅读(128) 评论(0) 推荐(0) 编辑
摘要: /* * author:lx * date:2011.09.22 * brief: insertion-sort */#include <stdio.h>#include <stdlib.h>void insertion_sort( int *p, int len ){ int j = 1; int key = 0; int i; for ( ; j < len; j++ ) { key = p[j]; i = j - 1; while... 阅读全文
posted @ 2011-09-22 16:17 lxgeek 阅读(138) 评论(0) 推荐(0) 编辑
摘要: /* * brief: genericity programming * */#include <stdio.h>#include <stdlib.h>#include <assert.h>#define GENERIC_STACK( STACK_TYPE, SUFFIX, STACK_SIZE ) \ \ static STACK_TYPE stack##SUFFIX[ STACK_SIZE ]; \ st... 阅读全文
posted @ 2011-09-17 15:56 lxgeek 阅读(168) 评论(0) 推荐(0) 编辑
摘要: /* * author: lx * date: 2011-09-16 * brief: programming pearls column2 */#include <stdio.h>#include <stdlib.h>voidmove_vector( char* b, int m, int n ){ int i = 0; int j; char temp; for ( ; i < n ; i++ ) { for ( j = i; j < m; j += n ) {... 阅读全文
posted @ 2011-09-17 13:23 lxgeek 阅读(178) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <stdlib.h>typedef unsigned char *byte_pointer;voidshow_bytes( byte_pointer start, int len ){ int i; for ( i = 0; i < len; i++ ) printf( " %.2x", start[i] ); printf( "\n" );}voidshow_int( int x ){ show_bytes( ( byte_pointer )&x, si... 阅读全文
posted @ 2011-09-15 19:13 lxgeek 阅读(198) 评论(0) 推荐(0) 编辑
摘要: /* * author: lx * date: 2011-09-08 * brief: the interface of list * file: llist.c */#include <stdio.h>#include <stdlib.h>#include "llist.h"intinsert_list( register Node **linkp, int new_value ){ register Node *current; register Node *new; while ( ( current = *linkp ) != NULL &a 阅读全文
posted @ 2011-09-15 16:27 lxgeek 阅读(156) 评论(0) 推荐(0) 编辑
摘要: /*ID: lxlenovos1PROG: beadsLANG: C++*/#include <iostream>#include <fstream>#include <string>#include <vector>#include <string.h>#include <stdlib.h>#include <stdio.h>using namespace std;typedef struct ring{ char a; struct ring *flink; struct ring *slink;} rin 阅读全文
posted @ 2011-08-10 21:53 lxgeek 阅读(285) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <stdlib.h>#include <malloc.h>#include <assert.h>#include <pthread.h>#define FALSE 0pthread_mutex_t thread_mutex = PTHREAD_MUTEX_INITIALIZER;pthread_mutex_t task_mutex = PTHREAD_MUTEX_INITIALIZER;struct temp{ int name;};#define STACK_TYPE struc 阅读全文
posted @ 2011-08-10 14:08 lxgeek 阅读(362) 评论(0) 推荐(0) 编辑
摘要: fromhttps://gist.github.com/1130407#!/usr/bin/python# -*- coding: utf-8 -*-"""A simple thread pool.@author: Junaid P V@license: GPLv3""" from threading import Thread, RLock, Lockfrom time import sleepfrom functools import wrapsdef synchronous( tlockname ): ""& 阅读全文
posted @ 2011-08-09 21:04 lxgeek 阅读(1290) 评论(0) 推荐(0) 编辑
摘要: #! /bin/bsh#查找文件中是否有eee如果没有在最后加入 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/gamesexport PATH#echo "`grep -n -e eee lxtest`"#输入要匹配的字符串 查询的文件if [ $# -ne 2 ] then echo "the string and file" exit 1fin1=$1n2=$2n3=`grep -n -e $n1 $n2`n4="eee"echo $ 阅读全文
posted @ 2011-05-30 21:28 lxgeek 阅读(198) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页