Recurrence Algorithm Big-Oh Solution
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的更多相关文章
- Backtracking algorithm: rat in maze
Sept. 10, 2015 Study again the back tracking algorithm using recursive solution, rat in maze, a clas ...
- H-Index I & II
H-Index I Given an array of citations (each citation is a non-negative integer) of a researcher, wri ...
- 【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 ...
- Careercup - Google面试题 - 4716965625069568
2014-05-06 00:17 题目链接 原题: Given a -D matrix represents the room, obstacle and guard like the followi ...
- *[codility]GenomicRangeQuery
http://codility.com/demo/take-sample-test/genomicrangequery 这题有点意思.一开始以为是RMQ或者线段树,但这样要O(n*logn).考虑到只 ...
- *[codility]MaxCounters
http://codility.com/demo/take-sample-test/maxcounters 简单题.注意要记录两个max,一个是最大值,一个是已经生效的最大值. // you can ...
- 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 ...
- codility上的问题 (23)Chi 2012
这个题也比较有意思.意思是给定一个数组A,长度为M,里面都是正整数,代表每块地形的高度.现在要测试一种加农炮,给定一个炮弹的高度H, 如果存在最小的I,满足0 < I < M,满足A[I ...
- codility上的练习(3)
今天发现又出了lesson 3... 不过题目都很简单…… (1) Min-avg-slice 给定一个长度为n的整数数组,找到一个连续的子数组,数组元素的平均值最小. 数据范围N [1..10^5] ...
随机推荐
- vue 内容增加滚动条自动定位至底部
this.$nextTick(() => { document.body.scrollTop = document.body.scrollHeight; console.log(document ...
- 【概率论】4-4:距(Moments)
title: [概率论]4-4:距(Moments) categories: - Mathematic - Probability keywords: - Moments - Moments Gene ...
- 页面的beforeunload和unload的事件应用
博主最近遇到一个需求,需要在用户离开之前给一个提示,是否确认离开,并且用户确认离开的话,需要发出一个请求 下面直接上代码: <!DOCTYPE HTML> <html> < ...
- spring-boot-starter-test
1.约定 单元测试代码写在src/test/java目录下 单元测试类命名为*Test,前缀为要测试的类名 2. 使用mock方式单元测试 Spring测试框架提供MockMvc对象,可以在不需要客户 ...
- linux密码忘记的处理步骤
linux忘记密码 centos7忘记密码如何解决?进入到单用户模式下去修改root密码step 1:开机时按住向下箭头,选择第一个,按住e进入gurb界面:step 2:在编辑模式下找ro 修改为 ...
- oracle自定义排序和NULL值排序
1.自定义顺序 当我们希望将某个查询结果指定的显示顺序展示的时候 order by case when column1=1 then 0 case when column1=1 then 1 else ...
- ORM SQLAlchemy 表于表的关系
1表与表之间三种关系 1.1 一对一关系 举例: 一个丈夫对应一个妻子,一个妻子对应一个丈夫 1.2 一对多关系 举例:一个人可以拥有多辆汽车,要求查询某个人拥有的所有车辆 分析:这种情况其实也可以采 ...
- legend3---13、vue是真的好用
legend3---13.vue是真的好用 一.总结 一句话总结: 下次前端所有的交互页面都可以用vue 1.chrome查看post请求携带的参数? 请求的Headers里面的Form Data里面 ...
- 初中知识回顾tan,sin,cos关系
如果K=tan, sin 是X x=k/power(1+k*k,0.5) 开平方 cos是y y=1.0/power(1+k*k,0.5) 开平方 gisoracle总结 ============= ...
- Default Keyboard Shortcut Schemes
Default Keyboard Shortcut Schemes All ReSharper actions can be invoked with keyboard shortcuts. Most ...