摘要: 编写一个非递归过程以O(N)时间反转单链表#include #include "./List.h"//利用我们自己实现的单链表Listusing namespace std;void PrintList(List L){ if(NULL == L) return; Position pos = First(L); cout"; pos = pos->next; } coutnext = NULL; while(NULL != pos) { Position tmp = pos->next; ... 阅读全文
posted @ 2013-07-17 11:58 老司机 阅读(894) 评论(1) 推荐(0) 编辑
摘要: 求并集————————————————————————————#include #include "./List.h"//利用我们自己实现的单链表Listusing namespace std;void PrintList(List L){ if(NULL == L) return; Position pos = First(L); cout"; pos = pos->next; } coutnext; } else { PushBack(Retrieve... 阅读全文
posted @ 2013-07-16 23:14 老司机 阅读(1128) 评论(0) 推荐(0) 编辑
摘要: 头文件————————————————————————————————//单链表的实现#ifndef _LIST_H_#define _LIST_H_#include #define Element intstruct node{ Element data; struct node *next;};typedef struct node* PtrToNode;typedef PtrToNode Position;typedef Position List;List MakeEmpty(List L);int IsEmpty(List L);int IsLast(Position... 阅读全文
posted @ 2013-07-16 11:47 老司机 阅读(915) 评论(4) 推荐(0) 编辑