码迷,mamicode.com
首页 >  
搜索关键字:divide    ( 1127个结果
LeetCode Divide Two Integers
Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT. 1 public class Solution { 2 public ...
分类:其他好文   时间:2015-01-12 00:18:28    阅读次数:293
[LeetCode]Divide Two Integers
Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 时间复杂度  log(n) public class Solution { public int divide(int dividend, int divi...
分类:其他好文   时间:2015-01-09 22:22:15    阅读次数:248
整数划分问题
描述 Given two positive integers N and M, please divide N into several integers A1, A2, ..., Ak (k >= 1), so that: 1. 0 2. A1 + A2 + ... + Ak = N; 3. A1, A2, ..., Ak are different with each oth...
分类:其他好文   时间:2015-01-05 13:04:23    阅读次数:121
归并排序算法--java
归并排序(Merge)是将两个(或两个以上)有序表合并成一个新的有序表,即把待排序序列分为若干个子序列,每个子序列是有序的。然后再把有序子序列合并为整体有序序列。归并排序是建立在归并操作上的一种有效的排序算法。该算法是采用分治法(Divide and Conquer)的一个非常典型的应用。 将已有序...
分类:编程语言   时间:2015-01-04 22:48:45    阅读次数:264
Factorial Trailing Zeroes (divide and conquer)
QUESTIONGiven an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.FIRST TRYclass Sol...
分类:其他好文   时间:2015-01-03 19:49:18    阅读次数:178
闲来无事,温习一下快速排序法
快速排序法,还是很常用的。不论是面试还是写代码。这里说一下怎么coding出快速排序法。至于什么复杂度之类的,请参考http://zh.wikipedia.org/wiki/%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F#C. 快速排序法的核心是分治法(Divide ...
分类:编程语言   时间:2015-01-01 19:48:14    阅读次数:216
LintCode-BackPack II
Given n items with size A[i] and value V[i], and a backpack with size m. What's the maximum value can you put into the backpack?NoteYou cannot divide ...
分类:其他好文   时间:2015-01-01 01:24:21    阅读次数:168
快速排序(Java实现)
在《算法导论》的第7章快速排序(QuiclSort)采用分治思想(Divide and Conquer)。对一个典型的子数组A[p..r]进行快速排序的三步分治过程:分解(divide):数组A[p..r]被划分为两个(可能为空)子数组A[p..q-1]和A[q+1..r],使得A[p..q-1]中...
分类:编程语言   时间:2014-12-30 16:51:34    阅读次数:198
[C++]LeetCode: 58 Maximum Subarray
题目: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [?2,1,?3,4,?1,2,1,?5,4], the contiguous subarray [4,?1,...
分类:编程语言   时间:2014-12-28 14:17:01    阅读次数:213
【LeetCode】Merge k Sorted Lists 解题报告
【题目】 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 合并几个有序链表为一个,分析算法复杂度。 【分治】 直观的想法是两两合并,有两种方法:1)list1和list2合并为newlist2,newlist2再和list3合...
分类:其他好文   时间:2014-12-26 11:12:18    阅读次数:129
1127条   上一页 1 ... 95 96 97 98 99 ... 113 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!