上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页
摘要: 时空复杂度: 阅读全文
posted @ 2018-03-26 01:58 davidnyc 阅读(100) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/intersection-of-two-linked-lists/description/ Write a program to find the node at which the intersection of two singly l 阅读全文
posted @ 2018-03-25 07:17 davidnyc 阅读(122) 评论(0) 推荐(0)
摘要: Given a node from a cyclic linked list which has been sorted, write a function to insert a value into the list such that it remains a cyclic sorted list. The given node can be any single node in the l... 阅读全文
posted @ 2018-03-23 03:46 davidnyc 阅读(103) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/insertion-sort-list/description/Sort a linked list using insertion sort.insertion sort 默认第一位已经SORT 好了, 取出下一位,然后从头比较。 一点一点向后面挪动time complexity: o(n^2)space complexity: o(1... 阅读全文
posted @ 2018-03-23 03:44 davidnyc 阅读(407) 评论(0) 推荐(0)
摘要: https://www.youtube.com/watch?v=kU9M51eKSX8 插入排序 插入排序(Insertion Sort)的基本操作就是将一个数据插入到已经排好序的有序数据中,从而得到一个新的、个数加一的有序数据,算法适用于少量数据的排序,时间复杂度为O(n^2)。是稳定的排序方法。 阅读全文
posted @ 2018-03-22 08:49 davidnyc 阅读(195) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/search-for-a-range/description/ Given an array of integers sorted in ascending order, find the starting and ending posit 阅读全文
posted @ 2018-03-22 03:19 davidnyc 阅读(136) 评论(0) 推荐(0)
摘要: 这是 Implement Deque Using Two Stacks 的升华版本, 存一半有效的把时间复杂度最坏情况降低到O(N/2) 这里最好,最坏的情况正好和 Implement Deque Using Two Stacks 相反。 最好的情况: 雨露均沾 最坏的情况:专宠一人 阅读全文
posted @ 2018-03-21 05:04 davidnyc 阅读(291) 评论(0) 推荐(0)
摘要: 个人感想: 这并没有优化太多,因为SHUFFLE 把整个都搬过去另一边, WORST CASE 的情况是 “雨露均沾”: 当你SHUFFLE 从左边到右边的时候, 马上REMOVELEFT, 那你就得马上再从右边SHUFFLE 到左边。。。 和捉迷藏一样,每次POP 都是O(N) 所以是很糟糕的一个 阅读全文
posted @ 2018-03-21 01:12 davidnyc 阅读(271) 评论(0) 推荐(0)
摘要: 1 public class ListNode { 2 public int val ; 3 public ListNode next; 4 public ListNode(int val) { 5 this.val = val; 6 this.next = null ; 7 } 8 9 } 1 publi... 阅读全文
posted @ 2018-03-20 11:28 davidnyc 阅读(185) 评论(0) 推荐(0)
摘要: 没有难度,但是需要理解:这其实是说TARGET 和 MID 的关系 阅读全文
posted @ 2018-03-20 01:26 davidnyc 阅读(164) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页