随笔分类 -  Linked List

摘要:自己写的一个无向图邻接表,edge代表邻接的节点,head代表邻接表主体节点。 不是很喜欢用数组建表,主要是因为数组建表虽然实现简单,但是理解略显复杂,这个方面可以参考朝夕的博客。 2016/12/18 阅读全文
posted @ 2016-12-18 10:03 Wasdns 阅读(343) 评论(2) 推荐(0) 编辑
摘要:题目见前文: "DS实验题 Old_Driver UnionFindSet结构" 这里使用邻接表存储敌人之间的关系,邻接表用指针实现: 2016/12/18 阅读全文
posted @ 2016-12-18 09:44 Wasdns 阅读(162) 评论(0) 推荐(0) 编辑
摘要:"5 5" "5 4" ifndef STUDENT_H define STUDENT_H include include using namespace std; class Student { private: int height; int weight; public: string nam 阅读全文
posted @ 2016-05-23 17:42 Wasdns 阅读(228) 评论(0) 推荐(0) 编辑
摘要:错误的代码: Node changedata(Node head) { Node p = head; while(p next != NULL) { p Nodenext = p next Nodenow; p = p next; } p Nodenext = 1; return head; } 改 阅读全文
posted @ 2016-05-21 16:19 Wasdns 阅读(214) 评论(0) 推荐(0) 编辑
摘要:``` #include #include #include using namespace std; struct Node { int data; Node *next; }; int tot = 0; Node *Node_Creat() { Node *head; head = (Node *)malloc(sizeof(Node)); if(head == NULL... 阅读全文
posted @ 2016-05-20 09:48 Wasdns 阅读(207) 评论(0) 推荐(0) 编辑
摘要:我所使用的方法在输入的时候是使用一个栈存储所有的数据,利用的是其先进后出的数据结构。 当然,用一个数组也是可以的= =,而且我觉得还可以保存数据,而用stack的话操作比较麻烦。 include include include include define LEN sizeof(Node) usin 阅读全文
posted @ 2016-05-18 22:45 Wasdns 阅读(332) 评论(0) 推荐(0) 编辑
摘要:链表 作为一种数据结构,链表以其方便的增删查改功能,实现了无数经典有用的程序。 在之前的帖子里,我构建链表的方式是建立一个不储存数据的head节点,然后通过一边输入数据一边建立结点的方式构建整个链表。 与之前不同的是,这里建立的是包含数据的头结点head: 下面是代码,包含创建部分,输出部分,删除部 阅读全文
posted @ 2016-05-17 21:27 Wasdns 阅读(190) 评论(0) 推荐(0) 编辑
摘要:注:此篇是我使用指针敲的一些题目的集成,有一些代码是重复的(挠头)。这样做的目的是进行前后的一些比较和收获一些心得(?)。 关于上一次我上台的题目: 题目:输入十个整数,进行排序。 做法1:(传递指针p) include include include using namespace std; vo 阅读全文
posted @ 2016-05-10 22:12 Wasdns 阅读(357) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示