Asymptotic Notation,
Algorithm-Analysis

sufficiently large N, P2 will be faster!
7/15
§2 Asymptotic Notation
【Definition】 T (N) = O( f (N) ) if there are positive constants c
【Definition】 T (N) = ( h(N) ) if and only if T (N) = O( h(N) ) and
T (N) = ( h(N) ) .
【Definition】 T (N) = o( p(N) ) if T (N) = O( p(N) ) and T (N)
( p(N) ) .
/* count ++ */
return 0; /* count ++ */ }
5/15
§1 What to Analyze
Take the iterative and recursive programs for summing a list for example --- if you think 2n+2 is WTlBStenohIsohuusecytminiott?tdhL’ubswrotayeneheetnhotrtoais’uasiGsolot2tilt’hTtfnya’locdelsswp+soIonrbktte3smdioseehBevxt,etpcrueqpeaheetsetsfsruclhcepsfi.Iy?tas.em?cro.stadsuapahitternotusrieeylUnotidcadsenr’ohereftanfsgdhf!tzooethhy!smrni!t..n.?e..a.ktinmsdoe.s.
算法常用术语中英对照

算法常用术语中英对照以下是一些算法常用术语的中英对照,供参考:1. Algorithm 算法2. Data structure 数据结构3. Array 数组4. Stack 栈5. Queue 队列6. Linked list 链表7. Tree 树8. Binary tree 二叉树9. Graph 图10. Hash table 哈希表11. Sorting algorithm 排序算法12. Bubble sort 冒泡排序13. Insertion sort 插入排序14. Selection sort 选择排序15. Merge sort 归并排序16. Quick sort 快速排序17. Binary search 二分查找18. Depth-first search (DFS) 深度优先19. Breadth-first search (BFS) 广度优先20. Dijkstra's algorithm 迪杰斯特拉算法21. Prim's algorithm 普里姆算法22. Greedy algorithm 贪心算法23. Dynamic programming 动态规划24. Recursion 递归25. Backtracking 回溯29. Big O notation 大O符号30. Worst case scenario 最坏情况31. Best case scenario 最好情况32. Average case scenario 平均情况33. Asymptotic analysis 渐近分析34. Brute force 暴力解法35. Heuristic algorithm 启发式算法36. Randomized algorithm 随机算法37. Divide and conquer 分治法38. Memorization 记忆化39. Online algorithm 在线算法40. Offline algorithm 离线算法41. Random access 随机访问42. Sequential access 顺序访问45. In-place algorithm 原地算法46. Stable algorithm 稳定算法47. Unstable algorithm 不稳定算法48. Exact algorithm 精确算法49. Approximation algorithm 近似算法这些术语覆盖了算法和数据结构的各个方面,从基础的数据结构到排序算法、算法、图算法等等。
山东建筑大学计算机学院算法分析算法复习题(Yuconan翻译)

1.The O-notation provides an asymptotic upper bound. The Ω-notationprovides an asymptotic lower bound. The Θ-notation asymptoticallya function form above and below.2.To represent a heap as an array,the root of tree is A[1], and giventhe index i of a node, the indices of its parent Parent(i) { return ⎣i/2⎦; },left child, Left(i) { return 2*i; },right child, right(i) { return 2*i + 1; }.代表一个堆中的一个数组,树的根节点是A[1],并且给出一个节点i,那么该节点的父节点是左孩子右孩子3.Because the heap of n elements is a binary tree, the height of anynode is at most Θ(lg n).因为n个元素的堆是一个二叉树,任意节点的树高最多是4.In optimization problems, there can be many possible solutions. Eachsolution has a value, and we wish to find a solution with the optimal (minimum or maximum) value. We call such a solution an optimal solution to the problem.在最优化问题中,有很多可能的解,每个解都有一个值,我们希望找到一个最优解(最大或最小),我们称这个解为最优解问题。
asymptotic名词形式

AsymptoticWhat is Asymptotic?Asymptotic is a term used in mathematics and computer science to describe the behavior of a function or algorithm as the input size grows towards infinity. It allows us to analyze the efficiency and performance of algorithms and make predictions about their behavior in the long run. Asymptotic analysis helps us identify the best algorithm for a given problem and understand how it scales with larger inputs.Big O NotationOne common way to express asymptotic behavior is through the use of Big O notation. Big O notation provides an upper bound on the growth rate of a function. It describes the worst-case scenario, or the slowest possible growth, as the size of the input increases.The Big O notation is represented as O(f(n)), where f(n) is a function representing the growth rate. For example, if an algorithm has a time complexity of O(n), it means that the runtime of the algorithm grows linearly with the size of the input. If the time complexity is O(n²), it means that the runtime grows quadratically with the input size.Asymptotic Complexity ClassesAsymptotic analysis allows us to categorize algorithms into different complexity classes based on their growth rates. Here are some commonly encountered complexity classes:1.O(1) - Constant Time Complexity: The algor ithm’s runtime remainsconstant, regardless of the input size. This is the most efficient complexity class.2.O(log n) - Logarithmic Time Complexity: The algorithm’s runtimegrows logarithmically with the input size. Common examples include binary search and some divide-and-conquer algorithms.3.O(n) - Linear Time Complexity: The algorithm’s runtime growslinearly with the input size. This is considered a good complexity class in most cases.4.O(n log n) - Linearithmic Time Complexity: The algorithm’sruntime grows in proportion to n multiplied by the logarithm of n.5.O(n²) - Quadratic Time Complexity: The algorithm’s runtime growsquadratically with the input size. This is considered lessefficient than linear time complexity.6.O(2^n) - Exponential Time Complexity: The algorithm’s runtimegrows exponentially with the input size. This is generallyconsidered inefficient and should be avoided if possible.There are also higher complexity classes such as O(n!) (factorial time complexity) and O(n^n) (polynomial time complexity), which are even less efficient.Analyzing Algorithms with Asymptotic MethodsTo analyze the efficiency of an algorithm, we typically look at three aspects: time complexity, space complexity, and auxiliary space complexity.Time Complexity: It meas ures how the algorithm’s runtime grows as the input size increases. It helps us understand how much time an algorithm will take to solve a problem of a certain size.Space Complexity: It measures how much additional memory an algorithm requires as the input size increases. It is important to optimize space usage, especially in resource-constrained environments.Auxiliary Space Complexity: It measures the extra space required by an algorithm apart from the input size. It helps us determine theadditional memory space needed for intermediate calculations or function calls.By analyzing these aspects, we can choose the most efficient algorithm for a given problem and estimate its performance with larger inputs. However, it’s important to note that asymptotic an alysis provides a high-level understanding of an algorithm’s efficiency. Other factors, such as the actual implementation details and hardware capabilities, can also affect the algorithm’s performance in practice.Asymptotic Notation in PracticeAsymptotic analysis and Big O notation are widely used in computer science and play a crucial role in algorithm design and analysis.Without understanding the asymptotic behavior of algorithms, it would be difficult to make informed decisions about which algorithm to use for a given problem.For example, suppose we have two algorithms to solve a sorting problem: Algorithm A with time complexity O(n²) and Algorithm B with time complexity O(n log n). If the input size is small, Algorithm A may perform better due to its lower constant factors. However, as the input size increases, Algorithm B will eventually outperform Algorithm A due to its better growth rate.Asymptotic analysis is also useful for predicting how an algorithm will perform when faced with larger datasets or when deployed in real-world scenarios. It helps us understand the inherent scalability of algorithms and make informed choices about system architecture and resource allocation.ConclusionAsymptotic analysis and the use of Big O notation are fundamental concepts in computer science and mathematics. They allow us to analyze the efficiency and behavior of algorithms as the input size grows. By understanding the asymptotic complexity of algorithms, we can make informed decisions about which algorithm to use for a given problem and estimate its performance with larger inputs.Remember, asymptotic analysis provides a high-level understanding of an algorithm’s behavior, and other factors, such as actual implementation details, hardware capabilities, and real-world constraints, can also impact the algorithm’s performance. Neverthe less, a solid understanding of asymptotic analysis is crucial for effectively designing and analyzing algorithms in various fields, including computer science, mathematics, and data science.。
数学专有名词英文词典

数学专有名词英文词典Mathematics Glossary: A Comprehensive English Dictionary of Mathematical TermsIntroduction:Mathematics is a language of numbers, shapes, patterns, and relationships. It plays a crucial role in various fields, including science, engineering, economics, and finance. To effectively communicate and understand mathematical concepts, it is essential to have a solid grasp of mathematical vocabulary. This article aims to provide a comprehensive English dictionary of mathematical terms, allowing readers to enhance their mathematical knowledge and fluency.A1. Abacus: A counting device that uses beads or pebbles on rods to represent numbers.2. Absolute Value: The distance of a number from zero on a number line, always expressed as a positive value.3. Algorithm: A set of step-by-step instructions used to solve a particular problem or complete a specific task.4. Angle: The measure of the separation between two lines or surfaces, usually measured in degrees.5. Area: The measure of the amount of space inside a two-dimensional figure, expressed in square units.B1. Base: The number used as a repeated factor in exponential notation.2. Binomial: An algebraic expression with two unlike terms connected by an addition or subtraction sign.3. Boundary: The edge or perimeter of a geometric shape.4. Cartesian Coordinates: A system that uses two number lines, the x-axis and y-axis, to represent the position of a point in a plane.5. Commutative Property: The property that states the order of the terms does not affect the result of addition or multiplication.C1. Circle: A closed curve with all points equidistant from a fixed center point.2. Congruent: Two figures that have the same shape and size.3. Cube: A three-dimensional solid shape with six square faces of equal size.4. Cylinder: A three-dimensional figure with two circular bases and a curved surface connecting them.5. Decimal: A number written in the base-10 system, with a decimal point separating the whole number part from the fractional part.D1. Denominator: The bottom part of a fraction that represents the number of equal parts into which a whole is divided.2. Diameter: The distance across a circle, passing through the center, and equal to twice the radius.3. Differential Equation: An equation involving derivatives that describes the relationship between a function and its derivatives.4. Dividend: The number that is divided in a division operation.5. Domain: The set of all possible input values of a function.E1. Equation: A mathematical statement that asserts the equality of two expressions, usually containing an equal sign.2. Exponent: A number that indicates how many times a base number should be multiplied by itself.3. Expression: A mathematical phrase that combines numbers, variables, and mathematical operations.4. Exponential Growth: A pattern of growth where the quantity increases exponentially over time.5. Exterior Angle: The angle formed when a line intersects two parallel lines.F1. Factor: A number or expression that divides another number or expression without leaving a remainder.2. Fraction: A number that represents part of a whole, consisting of a numerator anda denominator.3. Function: A relation that assigns each element from one set (the domain) to a unique element in another set (the range).4. Fibonacci Sequence: A sequence of numbers where each number is the sum of the two preceding ones.5. Frustum: A three-dimensional solid shape obtained by slicing the top of a cone or pyramid.G1. Geometric Sequence: A sequence of numbers where each term is obtained by multiplying the previous term by a common ratio.2. Gradient: A measure of the steepness of a line or a function at a particular point.3. Greatest Common Divisor (GCD): The largest number that divides two or more numbers without leaving a remainder.4. Graph: A visual representation of a set of values, typically using axes and points or lines.5. Group: A set of elements with a binary operation that satisfies closure, associativity, identity, and inverse properties.H1. Hyperbola: A conic section curve with two branches, symmetric to each other, and asymptotic to two intersecting lines.2. Hypotenuse: The side opposite the right angle in a right triangle, always the longest side.3. Histogram: A graphical representation of data where the data is divided into intervals and the frequency of each interval is shown as a bar.4. Hexagon: A polygon with six sides and six angles.5. Hypothesis: A proposed explanation for a phenomenon, which is then tested through experimentation and analysis.I1. Identity: A mathematical statement that is always true, regardless of the values of the variables.2. Inequality: A mathematical statement that asserts a relationship between two expressions, using symbols such as < (less than) or > (greater than).3. Integer: A whole number, either positive, negative, or zero, without any fractional or decimal part.4. Intersect: The point or set of points where two or more lines, curves, or surfaces meet.5. Irrational Number: A real number that cannot be expressed as a fraction or a terminating or repeating decimal.J1. Joint Variation: A type of variation where a variable is directly or inversely proportional to the product of two or more other variables.2. Justify: To provide a logical or mathematical reason or explanation for a statement or conclusion.K1. Kernel: The set of all inputs that map to the zero element of a function, often used in linear algebra and abstract algebra.L1. Line Segment: A part of a line bounded by two distinct endpoints.2. Logarithm: The exponent or power to which a base number must be raised to obtain a given number.3. Limit: The value that a function or sequence approaches as the input or index approaches a particular value.4. Linear Equation: An equation of the form Ax + By = C, where A, B, and C are constants, and x and y are variables.5. Locus: The set of all points that satisfy a particular condition or criteria.M1. Median: The middle value in a set of data arranged in ascending or descending order.2. Mean: The average of a set of numbers, obtained by summing all the values and dividing by the total count.3. Mode: The value or values that appear most frequently in a data set.4. Matrix: A rectangular array of numbers, symbols, or expressions arranged in rows and columns.5. Midpoint: The point that divides a line segment into two equal halves.N1. Natural Numbers: The set of positive whole numbers, excluding zero.2. Negative: A number less than zero, often represented with a minus sign.3. Nonagon: A polygon with nine sides and nine angles.4. Null Set: A set that contains no elements, often represented by the symbol Ø or { }.5. Numerator: The top part of a fraction that represents the number of equal parts being considered.O1. Obtuse Angle: An angle that measures more than 90 degrees but less than 180 degrees.2. Octagon: A polygon with eight sides and eight angles.3. Origin: The point (0, 0) on a coordinate plane, where the x-axis and y-axis intersect.4. Order of Operations: The set of rules for evaluating mathematical expressions, typically following the sequence of parentheses, exponents, multiplication, division, addition, and subtraction.5. Odd Number: An integer that cannot be divided evenly by 2.P1. Parabola: A conic section curve with a U shape, symmetric about a vertical line called the axis of symmetry.2. Pi (π): A mathematical constant representing the ratio of a circle's circumference to its diameter, approximately equal to3.14159.3. Probability: The measure of the likelihood that a particular event will occur, often expressed as a fraction, decimal, or percentage.4. Prime Number: A natural number greater than 1 that has no positive divisors other than 1 and itself.5. Prism: A three-dimensional figure with two parallel congruent bases and rectangular or triangular sides connecting the bases.Q1. Quadrant: One of the four regions obtained by dividing a coordinate plane into four equal parts.2. Quadrilateral: A polygon with four sides and four angles.3. Quartile: Each of the three values that divide a data set into four equal parts, each containing 25% of the data.4. Quotient: The result obtained from the division of one number by another.5. Quaternion: A four-dimensional extension of complex numbers, often used in advanced mathematics and physics.R1. Radius: The distance from the center of a circle or sphere to any point on its circumference or surface, always half of the diameter.2. Radical: The symbol √ used to represent the square root of a number or the principal root of a higher-order root.3. Ratio: A comparison of two quantities, often expressed as a fraction, using a colon, or as a verbal statement.4. Reflection: A transformation that flips a figure over a line, creating a mirror image.5. Rhombus: A parallelogram with all four sides of equal length.S1. Scalene Triangle: A triangle with no equal sides.2. Sector: The region bounded by two radii of a circle and the arc between them.3. Series: The sum of the terms in a sequence, often represented using sigma notation.4. Sphere: A three-dimensional object in which every point on the surface is equidistant from the center point.5. Square: A polygon with four equal sides and four right angles.T1. Tangent: A trigonometric function that represents the ratio of the length of the side opposite an acute angle to the length of the adjacent side.2. Theorem: A mathematical statement that has been proven to be true based on previously established results.3. Transversal: A line that intersects two or more other lines, typically forming angles at the intersection points.4. Trapezoid: A quadrilateral with one pair of parallel sides.5. Triangle: A polygon with three sides and three angles.U1. Union: The combination of two or more sets to form a new set that contains all the elements of the original sets.2. Unit: A standard quantity used to measure or compare other quantities.3. Unit Circle: A circle with a radius of 1, often used in trigonometry to define trigonometric functions.4. Undefined: A term used to describe a mathematical expression or operation that does not have a meaning or value.5. Variable: A symbol or letter used to represent an unknown or changing quantity in an equation or expression.V1. Vertex: A point where two or more lines, rays, or line segments meet.2. Volume: The measure of the amount of space occupied by a three-dimensional object, often expressed in cubic units.3. Variable: A symbol or letter used to represent an unknown or changing quantity in an equation or expression.4. Vector: A quantity with both magnitude (size) and direction, often represented as an arrow.5. Venn Diagram: A graphical representation of the relationships between different sets using overlapping circles or other shapes.W1. Whole Numbers: The set of non-negative integers, including zero.2. Weighted Average: An average calculated by giving different weights or importance to different values or data points.3. Work: In physics, a measure of the energy transfer that occurs when an object is moved against an external force.4. Wavelength: The distance between two corresponding points on a wave, often represented by the symbol λ.5. Width: The measurement or extent of something from side to side.X1. x-axis: The horizontal number line in a coordinate plane.2. x-intercept: The point where a graph or a curve intersects the x-axis.3. x-coordinate: The horizontal component of a point's location on a coordinate plane.4. xy-plane: A two-dimensional coordinate plane formed by the x-axis and the y-axis.5. x-variable: A variable commonly used to represent the horizontal axis or the input in a mathematical equation or function.Y1. y-axis: The vertical number line in a coordinate plane.2. y-intercept: The point where a graph or a curve intersects the y-axis.3. y-coordinate: The vertical component of a point's location on a coordinate plane.4. y-variable: A variable commonly used to represent the vertical axis or the output in a mathematical equation or function.5. y=mx+b: The equation of a straight line in slope-intercept form, where m represents the slope and b represents the y-intercept.Z1. Zero: The number denoted by 0, often used as a placeholder or a starting point in the number system.2. Zero Pair: A pair of numbers that add up to zero when combined, often used in integer addition and subtraction.3. Zero Product Property: The property that states if the product of two or more factors is zero, then at least one of the factors must be zero.4. Zero Slope: A line that is horizontal and has a slope of 0.5. Zeroth Power: The exponent of 0, which always equals 1.Conclusion:This comprehensive English dictionary of mathematical terms provides an extensive list of vocabulary essential for understanding and communicating mathematical concepts. With the knowledge of these terms, readers can enhance their mathematical fluency and explore various branches of mathematics with greater confidence. Remember, mathematics is not just about numbers, but also about understanding the language that describes the beauty and intricacies of the subject.。
埃尔德什差异问题的证明

Now observe that χ˜3p3imq “ χ˜3p3qiχ˜3pmq “ χ3pmq. The function χ3 has mean zero on every interval of length three, and tn{3ju is equal to 1 mod 3, hence
It is instructive to consider some near-counterexamples to these results - that is to say, functions that are of unit magnitude, or nearly so, which have surprisingly small discrepancy - to isolate the key difficulty of the problem.
ˇn
ˇ
sup
ˇÿ ˇ
ˇ f pjdqˇ
ˇ
ˇ
n,dPN ˇj“1
ˇ
of f is infinite. This answers a question of Erdo˝s. In fact the argument also applies to sequences f taking values in the unit sphere of a real or complex Hilbert space.
j“1
and hence
›n
›
›ÿ ›
f
› pjq›
“
? k
`
1
"
alog
n.
›
›
›j“1
›
H
Conversely, if n is a natural number and d “ 3ld1 for some l “ 0, 1, . . .
and

)
(2)
for any constant c < 1/ 2. The upper bound (1) was improved by Godbole, et al. [5], to √ (3) τM (P ) = O (n2C lg n ) for any constant C > 1. Our main result of the paper improves the lower bound from [1], showing a lower bound which almost matches the upper bound from [5].
2
1
Introduction
Let G = (V, E ) be a connected graph on n vertices and let D be a configuration of t unlabeled pebbles on V (formally D is multiset of t elements from V , with D (v ) the number of pebbles on vertex v ). A pebbling step consists of removing two pebbles from a vertex v and placing one pebble on a neighbor of v . A configuration is called r -solvable if it is possible to move at least one pebble to vertex r by a sequence of pebbling steps. A configuration is called solvable if it is r -solvable for every vertex r ∈ V . The pebbling number of G is the smallest integer π (G) such that every configuration of t = π (G) pebbles on G is solvable. Pebbling problems have a rich history and we refer to [6] for a thorough discussion. Standard asymptotic notation will be used in the paper. For two functions f = f (n) and g = g (n), we write f ≪ g (or f ∈ o(g )) if f /g approaches zero as n approaches infinity, f ∈ O (g ) (f ∈ Ω(g )) if there exist positive constants c, k such that f < cg (f > cg ) whenever n > k . In addition, f ∈ Θ(g ) when f ∈ O (g ) and g ∈ O (f ). We will also use f ∼ g if f /g approaches 1 as n approaches infinity. Finally to simplify the exposition we shall always assume, whenever needed, that our functions take integer values. We will be mainly interested in the following random model considered in [2]. A configuration D of t pebbles assigned to G is selected randomly and t−1 uniformly from all n+t configurations. The problem to investigate, then, is to find what values of t, as functions of the number of vertices n = n(G), make D almost surely solvable. More precisely, a function t = t(n) is called a threshold of a graph sequence G = (G1 , . . . , Gn , . . .), where Gn has n vertices, if the following conditions hold as n tends to infinity: 1. for t1 ≪ t the probability that a configuration of t1 pebbles is solvable tends to zero, and 2. for t2 ≫ t the probability that a configuration of t2 pebbles is solvable tends to one. We denote by τM (G ) the set of all threshold functions of G in the multiset model. It is not immediately clear, however, that τM (G ) is nonempty for all G . Nonetheless it is proven to be the case in [1]. In this paper, we will study thresholds in the case when G is the family of paths. First let us note that the pebbling number of a path on n vertices is equal to 2n−1 . However, most of the configurations on t pebbles with t much smaller than 2n−1 will still be 3
算法chap03

Abuse
sufficiently large n
In stead of writing “f(n)∈ (g(n))”, we write f(n) = (g(n))” to indicate that f(n) is a member of (g(n))
Asymptotic tight bound
bound, we use -notation.
f (n) ( g (n))
2 2
f (n) O( g (n)) f (n) ( g (n))
2 2
an bn c O(n ) an bn c (n )
Байду номын сангаасnotation(1)
– (g(n)) = {f (n) : there exist positive constants c and n0 such that 0 ≤ c g(n) ≤ f(n) for all n ≥ n0} . g(n) is an asymptotic lower bound for f(n). – Example: n = (lg n), with c=1 and n0 =16. – Examples of functions in (n² ): n² n² n, n² n, 1000n² 1000n, , + + 1000n² 1000n, Also, n³ n 2.0000 , n² lg lg n, , lg
1 2 c1n n 3n c2 n 2 2
2
1 3 0 c1 c2 , n n0 2 n
1 1 n 6 n0 7, c2 , c1 2 14
Continue
Intuitively, the lower-order terms of an asymptotically positive function can be ignored in determining asymptotically tight bound because they are insignificant for large n. The coefficient of the highest-order term can likewise be ignored, since it only changes c1 and c2 by a constant factor equal to the coefficient.
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Any linear function an + b is in O(n2). How? Show that 3n3 = O(n4) for appropriate c and n0. Show that 3n3 = O(n3) for appropriate c and n0.
asymp - 8
Ω -notation
asymp - 2
Θ-notation
lgn, n, n2, n3, …
For function g(n), we define Θ(g(n)), big-Theta of n, as the set: Θ(g(n)) = {f(n) : ∃ positive constants c1, c2, and n0, such that ∀n ≥ n0, we have 0 ≤ c1g(n) ≤ f(n) ≤ c2g(n)
asymp - 13
Example
Insertion sort takes Θ(n2) in the worst case, so sorting (as a problem) is O(n2). Why? Any sort algorithm must look at each item, so sorting is Ω(n). In fact, using (e.g.) merge sort, sorting is Θ(n lg n) in the worst case.
f(n) becomes insignificant relative to g(n) as n approaches infinity:
lim [f(n) / g(n)] = 0
n→∞
g(n) is an upper bound for f(n) that is not asymptotically tight. Observe the difference in this definition from previous ones. Why?
}
Intuitively: Set of all functions that have the same rate of growth as g(n).
g(n) is an asymptotically tight bound for any f(n) in the set.
asymp - 3
Θ-notation
f(n) = Θ(g(n)) ⇒ f(n) = Ω(g(n)). Θ(g(n)) ⊂ Ω(g(n)).
asymp - 9
Example
Ω(g(n)) = {f(n) : ∃ positive constants c and n0, such that ∀n ≥ n0, we have 0 ≤ cg(n) ≤ f(n)}
f(n) = Θ(g(n)) ⇒ f(n) = O(g(n)). Θ(g(n)) ⊂ O(g(n)).
asymp - 7
Examples
O(g(n)) = {f(n) : ∃ positive constants c and n0, such that ∀n ≥ n0, we have 0 ≤ f(n) ≤ cg(n) }
Intuitively: Set of all functions whose rate of growth is the same as or lower than that of g(n).
g(n) is an asymptotic upper bound for any f(n) in the set.
In the example above, Θ(n2) stands for 3n2 + 2n + 1.
asymp - 15
o-notation
For a given function g(n), the set little-o:
o(g(n)) = {f(n): ∀ c > 0, ∃ n0 > 0 such that ∀ n ≥ n0, we have 0 ≤ f(n) < cg(n)}.
10n2 - 3n = Θ(n2) What constants for n0, c1, and c2 will work? Make c1 a little smaller than the leading coefficient, and c2 a little bigger. To compare orders of growth, look at the leading term (highest-order term). Exercise: Prove that n2/2-3n= Θ(n2)
“Running time is O(f(n))” ⇒ Worst case is O(f(n)) O(f(n)) bound on the worst-case running time ⇒ O(f(n)) bound on the running time of every input. Θ(f(n)) bound on the worst-case running time ⇒ Θ(f(n)) bound on the running time of every input. “Running time is Ω(f(n))” ⇒ Best case is Ω(f(n)) Can still say “Worst-case running time is Ω(f(n))” Means worst-case running time is given by some unspecified function g(n) ∈ Ω(f(n)).
Instead of exact running time, we use asymptotic notations such as O(n), Θ(n2), (n).
Describes behavior of running time functions by setting lower and upper bounds for their values.
asymp - 5
Example
Θ(g(n)) = {f(n) : ∃ positive constants c1, c2, and n0, such that ∀n ≥ n0, 0 ≤ c1g(n) ≤ f(n) ≤ c2g(n)}
Is 3n3 ∈ Θ(n4) ? How about 22n∈ Θ(2n)?
}
Technically, f(n) ∈ Θ(g(n)). Older usage, f(n) = Θ(g(n)). I’ll accept either… f(n) and g(n) are nonnegative, for large n.
asymp -Leabharlann 4ExampleΘ(g(n)) = {f(n) : ∃ positive constants c1, c2, and n0, such that ∀n ≥ n0, 0 ≤ c1g(n) ≤ f(n) ≤ c2g(n)}
Intuitively: Set of all functions whose rate of growth is the same as or higher than that of g(n).
g(n) is an asymptotic lower bound for any f(n) in the set.
Later, we will prove that we cannot hope that any comparison sort to do better in the worst case.
asymp - 14
Asymptotic Notation in Equations
Can use asymptotic notation in equations to replace expressions containing lower-order terms. For example, 4n3 + 3n2 + 2n + 1 = 4n3 + 3n2 + Θ(n) = 4n3 + Θ(n2) = Θ(n3). How to interpret? In equations, Θ(f(n)) always stands for an anonymous function g(n) ∈ Θ(f(n))
asymp - 1
Asymptotic Notation
Θ, O, Ω, o, ω Defined for functions over the natural numbers. Ex: f(n) = Θ(n2). Describes how f(n) grows in comparison to n2. Define a set of functions; in practice used to compare two function values. The notations describe different rate-of-growth relations between the defining function and the defined set of functions.
For function g(n), we define Θ(g(n)), big-Theta of n, as the set: Θ(g(n)) = {f(n) : ∃ positive constants c1, c2, and n0, such that ∀n ≥ n0, we have 0 ≤ c1g(n) ≤ f(n) ≤ c2g(n)
That is, Θ(g(n)) = O(g(n)) ∩ Ω(g(n)) In practice, asymptotically tight bounds are obtained from asymptotic upper and lower bounds.