Recurrence Algorithm Big-Oh Solution

T(n) = T(n/2) + O(1) Binary SearchO(log n)
T(n) = T(n-1) + O(1) Sequential SearchO(n)
T(n) = 2 T(n/2) + O(1) Tree TraversalO(n)
T(n) = T(n-1) + O(n) Selection Sort (other n2 sorts)O(n2)
T(n) = 2 T(n/2) + O(n) Mergesort (average case Quicksort)O(n log n)
T(n) = T(n - 1) + T(n - 2) + ..... + T(1) or T(n) = a + 2 * T(n - 1) Exponential
T(n) = n * T(n - 1) + O(1)  Salesman Problem O(n!)

https://yourbasic.org/algorithms/time-complexity-recursive-functions/

Recurrence Algorithm Big-Oh Solution的更多相关文章

  1. Backtracking algorithm: rat in maze

    Sept. 10, 2015 Study again the back tracking algorithm using recursive solution, rat in maze, a clas ...

  2. H-Index I & II

    H-Index I Given an array of citations (each citation is a non-negative integer) of a researcher, wri ...

  3. 【LeetCode】242 - Valid Anagram

    Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = &q ...

  4. Careercup - Google面试题 - 4716965625069568

    2014-05-06 00:17 题目链接 原题: Given a -D matrix represents the room, obstacle and guard like the followi ...

  5. *[codility]GenomicRangeQuery

    http://codility.com/demo/take-sample-test/genomicrangequery 这题有点意思.一开始以为是RMQ或者线段树,但这样要O(n*logn).考虑到只 ...

  6. *[codility]MaxCounters

    http://codility.com/demo/take-sample-test/maxcounters 简单题.注意要记录两个max,一个是最大值,一个是已经生效的最大值. // you can ...

  7. the Linux Kernel: Traffic Control, Shaping and QoS

    −Table of Contents Journey to the Center of the Linux Kernel: Traffic Control, Shaping and QoS 1 Int ...

  8. codility上的问题 (23)Chi 2012

    这个题也比较有意思.意思是给定一个数组A,长度为M,里面都是正整数,代表每块地形的高度.现在要测试一种加农炮,给定一个炮弹的高度H, 如果存在最小的I,满足0 < I <  M,满足A[I ...

  9. codility上的练习(3)

    今天发现又出了lesson 3... 不过题目都很简单…… (1) Min-avg-slice 给定一个长度为n的整数数组,找到一个连续的子数组,数组元素的平均值最小. 数据范围N [1..10^5] ...

随机推荐

  1. 內嵌html字符串顯示

    前端:System.Web.HttpUtility.HtmlEncode()            @Html.Raw(htmlStr) 後端:System.Net.WebUtility.HtmlDe ...

  2. .netcore signalR 实时消息推送

    服务器端引入包 Install-Package Microsoft.AspNetCore.SignalR客户端引入包  npm install @aspnet/signalr <template ...

  3. 8月清北学堂培训 Day3

    今天是赵和旭老师的讲授~ 状态压缩 dp 状态压缩是设计 dp 状态的一种方式. 当普通的 dp 状态维数很多(或者说维数与输入数据有关),但每一维总量很少时,可以将多维状态压缩为一维来记录. 这种题 ...

  4. 2016"百度之星" - 初赛(Astar Round2A)1001 All X(HDU5690)——找循环节|快速幂

    一个由m个数字x组成的新数字,问其能否mod k等于c. 先提供第一种思路,找循环节.因为每次多一位数都是进行(t*10+x)mod k(这里是同余模的体现),因为x,k都确定,只要t再一样得到的答案 ...

  5. ICEM-extrude功能画圆柱绕流网格【转载】

    转载自:http://blog.csdn.net/lgw19910426/article/details/26401517 首先画网格大体顺序为点-->线-->面-->单元体. 第一 ...

  6. 对@repository,@Service, @Compent,@Controller注解的理解

    注解是没什么本质区别,都是声明作用,取不同的名字只是为了更好区分各自的功能. @Repository 用于标注数据访问组件,即DAO组件 @Service 用于标注业务层组件 @Controller ...

  7. 【java中的final关键字】

    转自:https://www.cnblogs.com/xiaoxi/p/6392154.html 一.final关键字的基本用法 在Java中,final关键字可以用来修饰类.方法和变量(包括成员变量 ...

  8. 5 HashSet

    1.HashSet public class HashSet<E> extends AbstractSet<E> implements Set<E>, Clonea ...

  9. MySQL中information_schema数据库是干啥的

    大家在安装或使用MYSQL时,会发现除了自己安装的数据库以外,还有一个 information_schema数据库.information_schema数据库是做什么用的呢,使用WordPress博客 ...

  10. Python在for循环中更改list值的方法

    一.在for循环中直接更改列表中元素的值不会起作用: 如: l = list(range(10)[::2]) print (l) for n in l: n = 0 print (l) 运行结果: [ ...