数据结构
夕里子
这个作者很懒,什么都没留下…
展开
-
单链表的拆分
#include using namespace std;typedef struct Node{ char val; Node *next;}LST;LST *mycreat(LST *head,char v){ LST *p=new LST; LST *q=new LST; q=head; while(q->next) { q=q->next; } p->va原创 2013-08-19 11:14:33 · 632 阅读 · 0 评论 -
单链表的插入
#include using namespace std;typedef struct Node{ int val; Node *next;}node;node* mycreat(){ node *head=NULL,*p=NULL,*ne=NULL; head=(node*)malloc(sizeof(node)); p=head; int v;原创 2013-08-11 11:20:33 · 422 阅读 · 0 评论 -
单链表的复制
#include using namespace std;typedef struct Node{ double val; Node *next;}node;node* mycreat(double n){ node *head=NULL,*p=NULL,*sec=NULL; head=(node*)malloc(sizeof(node)); p=hea原创 2013-08-09 11:22:19 · 2384 阅读 · 0 评论 -
单链表的遍历与长度计算
#include using namespace std;typedef struct Node{ int val; Node *next;}node;int sum;node* mycreat(int n){ node *head=NULL,*p=NULL,*ne=NULL; head=(node*)malloc(sizeof(node));原创 2013-08-08 11:31:01 · 1582 阅读 · 0 评论 -
单链表的建立和遍历
#include using namespace std;typedef struct Node { int count; struct Node *next;}node;node* mycreat(int n){ int val; node *head=NULL,*p=NULL,*ne=NULL; head=(node*)malloc(sizeof(n原创 2013-08-08 10:12:23 · 1329 阅读 · 0 评论 -
单链表删除相同值
#include using namespace std;struct node{ int val,c; node *next; node() { c=0; }};node *mycreat(int n){ node *head=NULL,*p=NULL,*sec=NULL; head=(node*)malloc(sizeof(node)); p=head; wh原创 2013-08-19 11:16:40 · 612 阅读 · 0 评论 -
单链表排序
#include using namespace std;typedef struct Node { int val; Node *next;}LST;LST *mycreat(int n){ LST *head=NULL,*p=NULL,*sec=NULL; head=(LST*)malloc(sizeof(LST)); p=head; while(n--) { i原创 2013-08-19 11:15:54 · 475 阅读 · 0 评论 -
单链表连续删除
#includeusing namespace std;typedef struct Node { int val; Node *next;}LST;LST *mycreat(int n){ LST *p=NULL,*sec=NULL; LST *head=new LST; p=head; while(n--) { int v; scanf("%d",&v);原创 2013-08-19 11:15:19 · 803 阅读 · 0 评论 -
单链表按值操作
#include using namespace std;typedef struct Node{ int val; Node *next;}node;node* mycreat(int n){ node *head=NULL,*p=NULL,*sec=NULL; head=(node*)malloc(sizeof(node)); p=head; while (n--)原创 2013-08-19 11:02:19 · 623 阅读 · 0 评论 -
单链表按值操作
#include using namespace std;typedef struct Node{ int val; Node *next;}node;node* mycreat(int n){ node *head=NULL,*p=NULL,*sec=NULL; head=(node*)malloc(sizeof(node)); p=head; while (n--)原创 2013-08-19 11:20:27 · 639 阅读 · 0 评论 -
删除单链表中特定值
#includeusing namespace std;typedef struct Node { int val; Node *next;}LST;LST *mycreat(int n){ LST *head=NULL,*p=NULL,*sec=NULL; head=(LST*)malloc(sizeof(LST)); p=head; while(n--) { in原创 2013-08-19 11:18:08 · 605 阅读 · 0 评论 -
单链表中删除重复值
#include #include using namespace std;typedef struct Node{ int val,c; Node *next;}LST;int cmp(int a,int b){ return a<b?1:0;}LST *mycreat(int n){ int i=0,a[1001]; int t=n; while (t--)原创 2013-08-19 11:17:36 · 695 阅读 · 0 评论 -
单链表操作
#includeusing namespace std;typedef struct Node{ int val; Node *next;}node;node* mycreat(int n){ node *head=NULL,*p=NULL,*sec=NULL; head=(node*)malloc(sizeof(node)); p=head; while(n--) {原创 2013-08-12 11:32:04 · 486 阅读 · 0 评论