摘要: 题目:Sort a linked list using insertion sort,即仿照插入排序(直接插入排序)对一个链表排序。 插入排序的思想:总共进行n-1趟排序,在排列第i个元素时,前面的i个元素是有序的,将第i个元素插入到前i个元素中,并且保证被插入的数组是有序的,数组是顺序存储的,... 阅读全文
posted @ 2015-04-14 23:54 sunp823 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. ... 阅读全文
posted @ 2015-04-14 23:39 sunp823 阅读(126) 评论(0) 推荐(0) 编辑