摘要: 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) 编辑