摘要: 开始结点:是指链表中的第一个结点,也就是没有直接前趋的那个结点。头指针:是一指向链表开始结点的指针(没有头结点时),单链表由头指针唯一确定,因此单链表可以用头指针的名字来命名。头结点:是在链表的开始结点之前附加的一个结点。有了头结点之后,头指针指向头结点,不论链表否为空,头指针总是非空。而且头指针的设置使得对链表的第一个位置上的操作与在表其他位置上的操作一致(都是在某一结点之后)。http://www.cnblogs.com/Jennifer/articles/2159484.htmlhttp://www.cnblogs.com/cpoint/archive/2010/12/20/191135 阅读全文
posted @ 2011-09-27 16:05 火腿骑士 阅读(423) 评论(0) 推荐(0) 编辑
摘要: //程式名:LinkStack.c//程式功能:链栈的实现//功能描述:置栈空、判栈空、压栈、出栈、取栈顶元素//http://student.zjzk.cn/course_ware/data_structure/web/xianxingbiao/xianxingbiao2.3.1.2.htm#include<stdio.h>#include<stdlib.h>//包含exit();typedefcharDataType;//假定数据类型为字符typedefstructstacknode{DataTypedata;structstacknode*next;}StackN 阅读全文
posted @ 2011-09-27 13:45 火腿骑士 阅读(154) 评论(0) 推荐(0) 编辑
摘要: #ifndef DICTIONARY_H#define DICTIONARY_H#include "hashtable.h"typedef struct { HashTable *table;} Dictionary;Dictionary *dictionary_construct();void dictionary_destroy(Dictionary *dictionary);void dictionary_add_entry(Dictionary *dictionary, const char *key, const char *... 阅读全文
posted @ 2011-09-27 12:58 火腿骑士 阅读(3837) 评论(0) 推荐(0) 编辑
摘要: #ifndef HASH_TABLE_H#define HASH_TABLE_H#include "linkedlist.h"typedef struct { int capacity; LinkedList **elements; int seed;} HashTable;HashTable *hash_table_construct(int size);HashTable *hash_table_clone(HashTable *table);void has_table_destroy_clone(HashTable *table);void hash_table_d 阅读全文
posted @ 2011-09-27 12:57 火腿骑士 阅读(432) 评论(0) 推荐(0) 编辑
摘要: #ifndef STRING_H#define STRING_H#define STRING_DEFAULT_CHUNK_SIZE 256typedef struct { char *value; int length; int capacity; int chunk_size;} String;String *string_construct(const char *value);String *string_construct_from_int(int value);void string_destroy(String *string);void string_se... 阅读全文
posted @ 2011-09-27 12:52 火腿骑士 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 栈实际应用现场:先入后出(顺序栈)#include "linkedlist.h"#include <stdlib.h>#include <stdio.h>#ifdef DMALLOC#include "dmalloc.h"#endiftypedef struct { LinkedList *list;} StackStack *stack_construct() { Stack *stack = NULL; stack = calloc(1, sizeof(Stack));if (stack == NULL) { return N 阅读全文
posted @ 2011-09-27 12:50 火腿骑士 阅读(204) 评论(0) 推荐(0) 编辑
摘要: #include "logger.h"#include <stdio.h>#include <sys/types.h>#include <time.h>#include <ctype.h>#include <sys/time.h>#include <time.h>#include <stdlib.h>#include <string.h>#define tAGO 257#define tDAY 258#define tDAY_UNIT 259#define tDAYZONE 26 阅读全文
posted @ 2011-09-27 12:47 火腿骑士 阅读(462) 评论(0) 推荐(0) 编辑
摘要: #include <time.h>#include "date.h"#include "gettimestamp.h"#include "logger.h"#include <time.h>#include <locale.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#ifdef DMALLOC#include "dmalloc.h"#endiftypedef struct 阅读全文
posted @ 2011-09-27 12:42 火腿骑士 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 队列实际应用现场:先入先出#include "queue.h"#include "linkedlist.h"#include <stdlib.h>#include <stdio.h>#ifdef DMALLOC#include "dmalloc.h"#endiftypedef struct { LinkedList *list;} Queue;Queue *queue_construct() { Queue *queue = NULL; /* * Allocate space for the object an 阅读全文
posted @ 2011-09-27 12:39 火腿骑士 阅读(368) 评论(2) 推荐(0) 编辑
摘要: #ifndef FILE_H#define FILE_H#include "descriptor.h"#include "date.h"#include "dictionary.h"#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <sys/time.h>#include <sys/types.h>#include <time.h>#include <unistd.h& 阅读全文
posted @ 2011-09-27 11:56 火腿骑士 阅读(216) 评论(0) 推荐(0) 编辑
摘要: #ifndef LINKED_LIST_H#define LINKED_LIST_Htypedef struct LinkedListNode { const void *data; struct LinkedListNode *prev; struct LinkedListNode *next;} LinkedListNode; typedef struct { LinkedListNode *head; LinkedListNode *current; LinkedListNode *tail; int size;} LinkedList;#define... 阅读全文
posted @ 2011-09-27 11:54 火腿骑士 阅读(232) 评论(0) 推荐(0) 编辑
摘要: #include <string.h>#include <stdlib.h>typedef struct LinkedList { char *s; struct LinkedList *next;} LinkedList;void freell(LinkedList *list){ LinkedList *cur = list; if(list == NULL) return; freell(list->next); free(list->s); free(list);}LinkedList *createll(char *s){ LinkedList * 阅读全文
posted @ 2011-09-27 11:45 火腿骑士 阅读(222) 评论(0) 推荐(0) 编辑
摘要: typedef struct _list { struct _list* plPrev; struct _list* plNext; void* p;} list;int ListCreate( list *pl ) { pl->plPrev = pl->plNext = pl; pl->p = NULL; return 0;}list *ListInsert( list *pl, void *p ) { list *plNew; if ( (plNew = (list*)malloc( sizeof( *plNew ))) == NULL )return NULL; plN 阅读全文
posted @ 2011-09-27 10:22 火腿骑士 阅读(249) 评论(0) 推荐(0) 编辑
摘要: #ifdef HAVE_CONFIG_H# include <config.h>#endif#include <errno.h>#include <stdlib.h>#include <string.h>#include <list0.h>#include <iterator0.h>#include <mailutils/errno.h>intmu_list_create (mu_list_t *plist){ mu_list_t list; int status; if (plist == NULL) ret 阅读全文
posted @ 2011-09-27 10:15 火腿骑士 阅读(275) 评论(0) 推荐(0) 编辑