摘要: 题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sing... 阅读全文
posted @ 2016-01-20 22:52 很好玩 阅读(486) 评论(0) 推荐(0) 编辑
摘要: 题目:Sort a linked list using insertion sort.思路:插入排序是一种O(n^2)复杂度的算法,基本想法相信大家都比较了解,就是每次循环找到一个元素在当前排好的结果中相对应的位置,然后插进去,经过n次迭代之后就得到排好序的结果了。了解了思路之后就是链表的基本操作了... 阅读全文
posted @ 2016-01-20 22:17 很好玩 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not ... 阅读全文
posted @ 2016-01-20 21:59 很好玩 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the or... 阅读全文
posted @ 2016-01-20 10:56 很好玩 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2-... 阅读全文
posted @ 2016-01-20 10:20 很好玩 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For e... 阅读全文
posted @ 2016-01-20 10:00 很好玩 阅读(209) 评论(0) 推荐(0) 编辑