![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
分治
liuchenjane
这个作者很懒,什么都没留下…
展开
-
Different Ways to Add Parentheses
Different Ways to Add Parentheses Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid ope转载 2016-09-23 20:07:25 · 226 阅读 · 0 评论 -
395. Longest Substring with At Least K Repeating Characters
395. Longest Substring with At Least K Repeating Characters Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appear转载 2016-10-24 21:59:04 · 283 阅读 · 0 评论 -
148. Sort List
Sort a linked list in O(n log n) time using constant space complexity. 思路:采用类似数组的分治排序的思想对链表进行排序,使其时间复杂度达到 O(n log n) 的要求。 先将链表分割成两部分,分别对其排好序。再将排好序的链表进行合并。 /** * Definition for singly-linked list.原创 2016-12-17 20:56:12 · 268 阅读 · 0 评论 -
从求逆序对和mergeSort谈起
先来谈谈mergeSort, 它是排序算法的一种,核心思想是:对一个数组nums[0,…,n],首先把它分成两部分nums[0,…,mid]和nums[mid+1,…,n],首先两个子数组是排好序的,只要对两个子数组进行整合,然后就排好序了,但是我们可以在对数组整合的时候,作好多事情,。。。 根据主定理,T(0,n)=T(0,(n-1)/2)+T((n-1)/2,n)+C, 其中C是合并时的时间复原创 2017-02-20 22:30:03 · 553 阅读 · 0 评论