摘要: //多项式相加 LinkList* add2Link(LinkList*L1, LinkList*L2) { LinkList*p1, *p2; LinkList*head , *pre, *p; head = new LinkList; head->next = NULL; pre = head; p1 = L1->next; p2 = L2->next; while (p1... 阅读全文
posted @ 2016-09-20 01:17 KennyRom 阅读(340) 评论(0) 推荐(0) 编辑
摘要: template void converse(LinkList*L) { LinkList *p, *q; p = L->next; L->next = NULL; while (p) { q = p; p = p->next; q->next = L->next; L->next = q; } } 阅读全文
posted @ 2016-09-20 00:36 KennyRom 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 文件功能:实现了动态建立一个学生信息的链表包括链表的创建、插入、删除、和打印输出学生信息包括姓名和分数 阅读全文
posted @ 2016-09-19 13:10 KennyRom 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 1、Definition Linked list consists of a series of nodes. Each nodes contains the element and a pointer which points to the next node. The last node's n 阅读全文
posted @ 2016-09-19 10:54 KennyRom 阅读(292) 评论(0) 推荐(0) 编辑
摘要: 1、Definition Arry数组是一种连续储存的List 储存方式:将线性表中的元素一次储存在连续的储存空间中。 2、Implementation 3、Operations (1)Insert element e at i (2)Delete element e at location i I 阅读全文
posted @ 2016-09-17 19:13 KennyRom 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 1、Definiation A list is a sequence. a0, a1,a2,..., aN (N>0) 2、Character For any list except the empty list, we say that Ai follows(or succeeds)Ai-1(i< 阅读全文
posted @ 2016-09-17 16:40 KennyRom 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 1、What is it? An abstract data type is a set of objects together with a set of operations. 抽象数据类型是带有一组操作的一组对象的集合。 ADTS=objects+operations 2、How to def 阅读全文
posted @ 2016-09-17 15:46 KennyRom 阅读(490) 评论(0) 推荐(0) 编辑
摘要: allcator是一个模板类 定义在memory头文件中,将内存分配与对象构造分开,分配的内存是原始的、未构造的 一、how to use 因其实一个类,则使用allcator时需要首先声明一个类对象 用对象分配内存 一些用法 通俗的来讲,allocator是一个向系统申请一段内存空间的工具,申请的 阅读全文
posted @ 2016-09-16 16:48 KennyRom 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 1、不使用相同的内置指针初始化多个智能指针(reset也不行) 2、不delete get() 返回的指针 3、不使用gat() 初始化 或reset 其他智能指针 4、如果使用get()返回的指针,要记住当最后一个智能指针被销毁后,指针就变得无效了。 5、if使用的智能指针管理的资源不是new分配 阅读全文
posted @ 2016-09-16 12:02 KennyRom 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 重做上一题,这次使用shared_ptr 而不是内置指针。上一题题目为:(编写函数,返回一个动态分配的int的vector。将此vector传递给另一个函数,这个函数读取标准输入,将读入的值保存在vector元素中。再将vector传递给另外一个函数,打印读入的值。记得在恰当的时刻delete ve 阅读全文
posted @ 2016-09-16 10:53 KennyRom 阅读(256) 评论(0) 推荐(0) 编辑