码迷,mamicode.com
首页 >  
搜索关键字:recursive    ( 581个结果
笔试算法题(55):快速排序实现之非递归实现,最小k值选择(non-recursive version, Minimal Kth Selection of Quick Sort)
议题:快速排序实现之五(非递归实现,短序列优先处理,减少递归栈大小)分析:算法原理:此算法实现适用于系统栈空间不足够快速排序递归调用的需求,从而使用非递归实现快速排序算法;使用显示下推栈存储快速排序中的每一次划分结果 (将left和right都压入堆栈),并且首先处理划分序列较短的子序列(也就是在得...
分类:其他好文   时间:2014-06-03 08:23:29    阅读次数:367
Iterative (non-recursive) Merge Sort
An iterative way of writing merge sort: #include using namespace std; void merge(int A[], int l, int r, int e, int B[]) { int i = l, j = r, k = l; while (i<r && j A[j]) B[k++] =...
分类:其他好文   时间:2014-06-03 02:33:24    阅读次数:215
Iterative (non-recursive) Quick Sort
An iterative way of writing quick sort: #include #include #include using namespace std; void quickSort(int A[], int n) { stack> stk; stk.push(make_pair(0, n-1)); while (!stk.empty()) { pair ...
分类:其他好文   时间:2014-06-03 00:16:43    阅读次数:357
递归练习(C语言)
本文地址:http://www.cnblogs.com/archimedes/p/recursive-practice.html,转载请注明源地址。1、炮弹一样的球状物体,能够堆积成一个金字塔,在顶端有一个炮弹,它坐落在一个4个炮弹组成的层面上,而这4个炮弹又坐落在一个9个炮弹组成的层面上,以此类推...
分类:编程语言   时间:2014-05-26 13:12:52    阅读次数:354
55. 2种方法求字符串的组合[string combination]
using recursive and bitwise methods to get string combinations.
分类:其他好文   时间:2014-05-25 12:26:56    阅读次数:187
[LeetCode] [Palindrome Number 2012-01-04]
Determine whether an integer is a palindrome. Do this without extra space.if use recursive, like check the first dig and last dig, then remove them, c...
分类:其他好文   时间:2014-05-23 02:45:15    阅读次数:230
Leetcode: Unique Paths
这道题最开始采用recursive的方法,结果犯了TLE(time limit exceeded)的错误,事实证明recursive的时间代价还是太高,所以改用DP的方法,把曾经算出来的结果存起来,我用的是一个M*N的matrix来存储 1 public class Solution { 2 ...
分类:其他好文   时间:2014-05-14 10:57:31    阅读次数:245
some simple recursive lisp programs
1. Write a procedure count-list to count the number of elements in a list1 (defun count-list (numbers)2 (if (null numbers) 03 (+ 1 (co...
分类:其他好文   时间:2014-05-09 05:41:41    阅读次数:307
TortoiseSVN里checkout depth各选项的含义
代表四种检出深度: 1、Fully recursive——全递归:检出完整的目录树,包含所有的文件或子目录。2、Immediate children,including folders——直接子节点,包含文件夹:检出目录,包含其中的文件或子目录,但是不递归展开子目录。3、Only file chli...
分类:其他好文   时间:2014-05-08 20:08:29    阅读次数:290
01背包 暴力搜索
/** 01背包,recursive* 05.08/2014*/#include #include #include #define MAXN 30000using namespace std;int N,W;int w[MAXN],v[MAXN];int solve(int i, int tw)....
分类:其他好文   时间:2014-05-08 14:54:25    阅读次数:271
581条   上一页 1 ... 56 57 58 59 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!