上一页 1 ··· 5 6 7 8 9 10 下一页
摘要: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists:A: a1 → a2 ↘ ... 阅读全文
posted @ 2015-09-25 21:19 dylqt 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 把两个排列好的链表,融合成新的排列好的链表 1、自己的朴素方式 /** * Definition for sing... 阅读全文
posted @ 2015-09-25 19:48 dylqt 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3. /** * Definition for singly-link... 阅读全文
posted @ 2015-09-25 19:47 dylqt 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 一、IO类1、iostream定义了读写流的基本类型,fstream定义了读写命名文件的类型,sstream定义了读写内存string对象的类型2、不能拷贝IO对象,因此不能将形参或返回类型设置为流类型:通常以引用方式传递和方回流3、读写一个IO对象会改变其状态,因此传递和返回的引用不能是const... 阅读全文
posted @ 2015-09-25 16:48 dylqt 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 一、定义抽象数据类型1、成员函数的声明必须在类的内部,定义可以内部也可以外部;作为接口组成部分的非成员函数,定义和声明都在外部如果类函数定义在类内部,则隐式为inline函数在声明时声明inline,然后在类外定义函数,可以可以构造inline函数inline成员函数应该和类的定义在同一个头文件中2... 阅读全文
posted @ 2015-09-25 15:59 dylqt 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 -->... 阅读全文
posted @ 2015-09-25 10:43 dylqt 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Reverse a singly linked list./** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct Li... 阅读全文
posted @ 2015-09-25 08:51 dylqt 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with co... 阅读全文
posted @ 2015-09-24 10:25 dylqt 阅读(134) 评论(0) 推荐(0) 编辑
摘要: #define ElementType intstruct Node;typedef struct Node *PtrToNode; //不懂书上分这么多步干嘛,后面自己写方便点typedef PtrToNode List;typedef PtrToNode Position;Lis... 阅读全文
posted @ 2015-09-23 21:54 dylqt 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 一、参数传递1、形参为引用类型时,将绑定到相应的实参上,否则为实参的拷贝;在C++中建议用引用类型代替指针2、const 形参:对于顶层的const,在函数形参中无效,也不能构成重载函数形参中尽量使用常量引用,对于普通引用会有误导,主要是非常量引用会导致函数不能接受常量的类型3、数组形参:传递给函数... 阅读全文
posted @ 2015-09-23 14:59 dylqt 阅读(138) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 下一页