摘要: 1---2---3 ---4---5---6---711---12---链表1:1---2---3---4---5---6---7链表2:11---12---4---5---6---7解决方案:1.直接将链表1中的节点与链表2中的节点进行比较;如果存在相同的则相交。缺点:效率慢。2.将链表1建... 阅读全文
posted @ 2015-04-15 21:53 hy1hy 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 1.第一种实现bool List_is_loop(slist *head){ slist *slow=head; slist *fast=head; while(NULL!=fast && NULL!=fast->next) { slow=slow->next; fast=fas... 阅读全文
posted @ 2015-04-15 21:16 hy1hy 阅读(159) 评论(0) 推荐(0) 编辑
摘要: int b[2]={2,3}; int c[2]={4,5}; int **p,**q,**m; q=new int*[2]; q[0]=new int; q[1]=new int; **q=c[0]; *(*q+1)=c[1]; delete q[0]; delete q[1]; dele... 阅读全文
posted @ 2015-04-11 19:47 hy1hy 阅读(1427) 评论(0) 推荐(0) 编辑
摘要: 1. for(i=0;i0; i--) 速度较快;i>0被底层优化成i!=0,可直接用符号位判断。 阅读全文
posted @ 2015-04-11 18:30 hy1hy 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 1. 默认成员函数Class Empty{ public: Empty(); // 缺省构造函数 Empty( const Empty& ); // 拷贝构造函数 ~Empty(); // 析构函数 Empty& operator=( const Empty& ); // 赋值运算符 Empty* ... 阅读全文
posted @ 2015-04-11 17:40 hy1hy 阅读(347) 评论(0) 推荐(0) 编辑