关于Growth of Functions

dracularking 2013-03-23 10:40:56


这三种notation定义如上,但我怎么觉得这三个表示法彼此是可以互换的,比方说


可以这样表示


是因为可以找到c1,c2,n0


但同样地,如果要表示为O(n^2),也可以找到c,n0

那究竟什么时候用Theta,什么时候用BigO,什么时候用Omega呢
...全文
122 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
FancyMouse 2013-03-25
  • 打赏
  • 举报
回复
引用 5 楼 dracularking 的回复:
引用 3 楼 FancyMouse 的回复:如果f(n)=n, g(n)=n^2。f(n) = O(g(n))没有问题,取N=1, c=1就可以做到f(n)=n<=c*n*n=c*g(n)。 g(n)=O(f(n))不成立。因为对于任何c,我取n为某一个大于c的整数,g(n)=n^2>c*n=c*f(n)。所以没有任何一个c满足要求,g(n)=O(f(n))不成立。 ……
>明白了,这个就其实相当于比较只能基于最高相同指数幂的系数中间,函数的增长潜力这样比才能体现出来 对于多项式是这样。但是O符号可以针对任意函数。 >(1/2)*n^2 - 3n 也可以 = O(n^2) 和 Omega(n^2) 吧 是
dracularking 2013-03-25
  • 打赏
  • 举报
回复
引用 3 楼 FancyMouse 的回复:
如果f(n)=n, g(n)=n^2。f(n) = O(g(n))没有问题,取N=1, c=1就可以做到f(n)=n<=c*n*n=c*g(n)。 g(n)=O(f(n))不成立。因为对于任何c,我取n为某一个大于c的整数,g(n)=n^2>c*n=c*f(n)。所以没有任何一个c满足要求,g(n)=O(f(n))不成立。
明白了,这个就其实相当于比较只能基于最高相同指数幂的系数中间,函数的增长潜力这样比才能体现出来 换句话说, (1/2)*n^2 - 3n 也可以 = O(n^2) 和 Omega(n^2) 吧
FancyMouse 2013-03-25
  • 打赏
  • 举报
回复
>因为对于任何c,我取n为某一个大于c的整数,g(n)=n^2>c*n=c*f(n) 说详细一点,n取任何大于c的整数都能让不等号反向。所以对于任何c都不存在对应的N。所以g(n)=O(f(n))不成立。
FancyMouse 2013-03-25
  • 打赏
  • 举报
回复
引用 2 楼 dracularking 的回复:
引用 1 楼 FancyMouse 的回复:n = O(n^2)的时候另两个用不了 n^2 = Omega(n)的时候另两个用不了 f = O(g) = Omega(g)的时候等价于f = Theta(g)。 谢谢,不过还是不太明白,咱们集中说为什么n = O(n^2)的时候另两个用不了的问题吧,难道这时候找不到一个存在的c1 让f(n)>=c1g(n)吗 很难想象……
如果f(n)=n, g(n)=n^2。f(n) = O(g(n))没有问题,取N=1, c=1就可以做到f(n)=n<=c*n*n=c*g(n)。 g(n)=O(f(n))不成立。因为对于任何c,我取n为某一个大于c的整数,g(n)=n^2>c*n=c*f(n)。所以没有任何一个c满足要求,g(n)=O(f(n))不成立。
dracularking 2013-03-25
  • 打赏
  • 举报
回复
引用 1 楼 FancyMouse 的回复:
n = O(n^2)的时候另两个用不了 n^2 = Omega(n)的时候另两个用不了 f = O(g) = Omega(g)的时候等价于f = Theta(g)。
谢谢,不过还是不太明白,咱们集中说为什么n = O(n^2)的时候另两个用不了的问题吧,难道这时候找不到一个存在的c1 让f(n)>=c1g(n)吗 很难想象啊 因为f(n)下限>=0,没有更多限制了,无法直接证明f(n)>=c1g(n)不成立
FancyMouse 2013-03-24
  • 打赏
  • 举报
回复
n = O(n^2)的时候另两个用不了 n^2 = Omega(n)的时候另两个用不了 f = O(g) = Omega(g)的时候等价于f = Theta(g)。
Harsh Bhasin, "Algorithms: Design and Analysis" English | ISBN: 0199456666 | 2015 | 692 pages Algorithms: Design and Analysis of is a textbook designed for the undergraduate and postgraduate students of computer science engineering, information technology, and computer applications. It helps the students to understand the fundamentals and applications of algorithms. The book has been divided into four sections: Algorithm Basics, Data Structures, Design Techniques and Advanced Topics. The first section explains the importance of algorithms, growth of functions, recursion and analysis of algorithms. The second section covers the data structures basics, trees, graphs, sorting in linear and quadratic time. Section three discusses the various design techniques namely, divide and conquer, greedy approach, dynamic approach, backtracking, branch and bound and randomized algorithms used for solving problems in separate chapters. The fourth section includes the advanced topics such as transform and conquer, decrease and conquer, number thoeretics, string matching, computational geometry, complexity classes, approximation algorithms, and parallel algorithms. Finally, the applications of algorithms in Machine Learning and Computational Biology areas are dealt with in the subsequent chapters. This section will be useful for those interested in advanced courses in algorithms. The book also has 10 appendixes which include topics like probability, matrix operations, Red-black tress, linear programming, DFT, scheduling, a reprise of sorting, searching and amortized analysis and problems based on writing algorithms. The concepts and algorithms in the book are explained with the help of examples which are solved using one or more methods for better understanding. The book includes variety of chapter-end pedagogical features such as point-wise summary, glossary, multiple choice questions with answers, review questions, application-based exercises to help readers test their understanding of the learnt concepts.

33,008

社区成员

发帖
与我相关
我的任务
社区描述
数据结构与算法相关内容讨论专区
社区管理员
  • 数据结构与算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧