摘要:
编写一个非递归过程以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; ... 阅读全文
摘要:
求并集————————————————————————————#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... 阅读全文
摘要:
头文件————————————————————————————————//单链表的实现#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... 阅读全文