找回密码
 FreeOZ用户注册
12
返回列表 发新帖回复
楼主: key
打印 上一主题 下一主题

[论坛技术] 两个有序数组中找第n个数(其中n小于任何一个数组的长度)

[复制链接]
31#
发表于 23-5-2009 23:49:26 | 只看该作者
原帖由 绿衣 于 23-5-2009 23:43 发表
如果说对O(n)还有感觉的话,可是n^2、 lgN和更复杂的..具体是怎么算出来的有比较容易掌握的方法吗?很多书和资料只给出个复杂度是多少,实在让我为难啊


说明你看的书不好
有空的话看introduction to algorithm,没空的话就看看wiki吧

评分

参与人数 1威望 +20 收起 理由
绿衣 + 20 多谢!

查看全部评分

回复  

使用道具 举报

32#
发表于 24-5-2009 10:52:22 | 只看该作者

对看wiki基本上就够了

NotationNameExample

                               
登录/注册后可看大图
constantDetermining if a number is even or odd; using a constant-size lookup table or hash table

                               
登录/注册后可看大图
inverse AckermannAmortized time per operation using a disjoint set

                               
登录/注册后可看大图
iterated logarithmicThe find algorithm of Hopcroft and Ullman on a disjoint set

                               
登录/注册后可看大图
log-logarithmicAmortized time per operation using a bounded priority queue[4]

                               
登录/注册后可看大图
logarithmicFinding an item in a sorted array with a binary search

                               
登录/注册后可看大图
polylogarithmicDeciding if n is prime with the AKS primality test

                               
登录/注册后可看大图
fractional powerSearching in a kd-tree

                               
登录/注册后可看大图
linearFinding an item in an unsorted list; adding two n-digit numbers

                               
登录/注册后可看大图
linearithmic, loglinear, or quasilinearPerforming a Fast Fourier transform; heapsort, or merge sort

                               
登录/注册后可看大图
quadraticMultiplying two n-digit numbers by a simple algorithm; adding two n×n matrices; bubble sort, shell sort,quicksort, or insertion sort

                               
登录/注册后可看大图
cubicMultiplying two n×n matrices by simple algorithm; finding the shortest path on a weighted digraph with theFloyd-Warshall algorithm; inverting a (dense) nxn matrix using LU or Cholesky decomposition

                               
登录/注册后可看大图
polynomial or algebraicTree-adjoining grammar parsing; maximum matching for bipartite graphs (grows faster than cubic if and only if c > 3)

                               
登录/注册后可看大图


                               
登录/注册后可看大图
L-notationFactoring a number using the special or general number field sieve

                               
登录/注册后可看大图
exponential orgeometricFinding the (exact) solution to the traveling salesman problem using dynamic programming; determining if two logical statements are equivalent using brute force

                               
登录/注册后可看大图
factorial or combinatorialSolving the traveling salesman problem via brute-force search; finding the determinant with expansion by minors. The statement

                               
登录/注册后可看大图
is sometimes weakened to

                               
登录/注册后可看大图
to derive simpler formulas for asymptotic complexity.

                               
登录/注册后可看大图
double exponentialDeciding the truth of a given statement in Presburger arithmetic

评分

参与人数 1威望 +20 收起 理由
ubuntuhk + 20 wiki是个好东西!

查看全部评分

回复  

使用道具 举报

33#
 楼主| 发表于 24-5-2009 16:17:05 | 只看该作者
原帖由 coredump 于 24-5-2009 10:52 发表
NotationNameExample

                               
登录/注册后可看大图
constantDetermining if a number is even or odd; using a constant-size lookup table or hash tablehttp://upl ...


背O()呀?
推荐看<Data Structures, Algorithms, and Applications in C++>,Sartaj Sahni,
中文版<数据结构、算法与应用--C++语言描述>,机械工业出版社,汪诗林等译
这本书第二章 程序性能中对于时间复杂性的讨论比较好,有空可以看一下。

然后就是klux说的MIT的Introduction to Algorithm,但这本书主要是数学计算,不头昏可以看一下

评分

参与人数 1威望 +20 收起 理由
绿衣 + 20 救星啊,我看了几眼introduction to algori ...

查看全部评分

回复  

使用道具 举报

您需要登录后才可以回帖 登录 | FreeOZ用户注册

本版积分规则

小黑屋|手机版|Archiver|FreeOZ论坛

GMT+10, 19-4-2024 21:44 , Processed in 0.043222 second(s), 22 queries , Gzip On, Redis On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表