摘要:
Reorder ListGiven 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' val... 阅读全文
posted @ 2015-11-17 11:29
Tri_tri_tri
阅读(177)
评论(0)
推荐(0)
摘要:
Merge k Sorted ListsMergeksorted linked lists and return it as one sorted list.Analyze and describe its complexity.ExampleGiven lists:[ 2->4->null, ... 阅读全文
posted @ 2015-11-17 11:26
Tri_tri_tri
阅读(144)
评论(0)
推荐(0)
摘要:
Partition ListGiven a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should pres... 阅读全文
posted @ 2015-11-17 11:09
Tri_tri_tri
阅读(117)
评论(0)
推荐(0)
摘要:
Insertion Sort ListSort a linked list using insertion sort.ExampleGiven1->3->2->0->null, return0->1->2->3->null.SOLUTION:插入排序的思路就是从头开始扫过去,然后遇到比当前点小的点,... 阅读全文
posted @ 2015-11-17 10:57
Tri_tri_tri
阅读(134)
评论(0)
推荐(0)
摘要:
Reverse Linked ListReverse a linked list.ExampleFor linked list1->2->3, the reversed linked list is3->2->1ChallengeReverse it in-place and in one-pass... 阅读全文
posted @ 2015-11-17 10:53
Tri_tri_tri
阅读(129)
评论(0)
推荐(0)
摘要:
Sort ListSort a linked list inO(nlogn) time using constant space complexity.ExampleGiven1-3->2->null, sort it to1->2->3->null.SOLUTION:这题是merge 2 sort... 阅读全文
posted @ 2015-11-17 10:47
Tri_tri_tri
阅读(142)
评论(0)
推荐(0)
摘要:
Merge Two Sorted Lists Merge two sorted (ascending) linked lists and return it as a new sorted list. The new sorted list should be made by splicing to 阅读全文
posted @ 2015-11-17 10:31
Tri_tri_tri
阅读(106)
评论(0)
推荐(0)
摘要:
Remove Nth Node From End of ListGiven a linked list, remove thenthnode from the end of list and return its head.ExampleGiven linked list: 1->2->3->4->... 阅读全文
posted @ 2015-11-17 10:00
Tri_tri_tri
阅读(108)
评论(0)
推荐(0)
摘要:
Minimum Adjustment CostGiven an integer array, adjust each integers so that the difference of every adjacent integers are not greater than a given num... 阅读全文
posted @ 2015-11-13 12:12
Tri_tri_tri
阅读(162)
评论(0)
推荐(0)
摘要:
链表的题基本可以说是基础题,不涉及算法,要熟记他的一些基本操作,基本技巧。链表的特点就是添加删除O(1),不费空间,比如重新组合一串数字,用array需要从新开一个数组,而链表不需要,只要改变指针就行。缺点是访问的时候,最坏可能到O(n)。我个人一般怕乱,所以不用双向表,就用单项表挺好的。1,dum... 阅读全文
posted @ 2015-11-12 01:18
Tri_tri_tri
阅读(540)
评论(0)
推荐(0)
浙公网安备 33010602011771号