0 Stimmen dafür0 Stimmen dagegen

0 Aufrufe26 SeitenDesign analysis

Aug 03, 2019

© © All Rights Reserved

DOCX, PDF, TXT oder online auf Scribd lesen

Design analysis

© All Rights Reserved

Als DOCX, PDF, TXT **herunterladen** oder online auf Scribd lesen

0 Aufrufe

Design analysis

© All Rights Reserved

Als DOCX, PDF, TXT **herunterladen** oder online auf Scribd lesen

- Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
- Hidden Figures Young Readers' Edition
- The Law of Explosive Growth: Lesson 20 from The 21 Irrefutable Laws of Leadership
- The E-Myth Revisited: Why Most Small Businesses Don't Work and
- The Wright Brothers
- The Power of Discipline: 7 Ways it Can Change Your Life
- The Other Einstein: A Novel
- The Kiss Quotient: A Novel
- State of Fear
- State of Fear
- The 10X Rule: The Only Difference Between Success and Failure
- Being Wrong: Adventures in the Margin of Error
- Algorithms to Live By: The Computer Science of Human Decisions
- The Black Swan
- Prince Caspian
- The Art of Thinking Clearly
- A Mind for Numbers: How to Excel at Math and Science Even If You Flunked Algebra
- The Last Battle
- The 6th Extinction
- HBR's 10 Must Reads on Strategy (including featured article "What Is Strategy?" by Michael E. Porter)

Sie sind auf Seite 1von 26

OF

ALGORITHMS

ASSIGNMENT

ASYMPTOTIC NOTATIONS

o SANSKAR MISHRA MR. KESHAV KAUSHIK

SAP ID : 500052531

ROLL NO: 25

Shreya

SAP ID : 500047217

Roll no: 64

TABLE OF CONTENTS-

What is asymptotic notation

Why do we need to use asymptotic notation

Ways to classify asymptotic notation

Classification of asymptotic notation

Big Oh O notation

Big omega(Ω) notation

Theta notation

Small o notation

Small ω notaion

Multiple choice question about asymptotic notation

True and False question about asymptotic notation

WHAT IS ASYMPTOTIC NOTATION?

asymptote and notation separately means then only we can sort out the real

meaning of asymptotic notation.

and closer but you will never reach that value. In mathematics asymptote is a

horizontal, vertical line that a curve approaches as it heads to infinity.

For example: Imagine that you are running in a 100 m race. After a 30m of

sprint, you are exhausted. After about a 10m of sprint which means 40m you

are more than halfway to your finish line, but you notice you are gradually

slowing down. Another 10m later, you have only sprinted another 1/4 of the

way to final line. Your legs continue to feel heavier and heavier. After another

10m, you are only another 1/8 of the way to finish line. The pattern continues.

As you are sprinting exhausted body drags even more and more, it seems like

you will never get there. Each additional minute only brings you halfway to the

finish line from where you were previously.

Now we have understood what asymptote really means so now we will try to

understand what notation means and will recollect both to understand the

meaning of asymptotic notation.

written symbols used to represent numbers, amounts, or elements in

something such as music or mathematics.

curve that never reaches to its actual value and the symbols by which we

denote them are known as asymptotic notations.

algorithm’s running time and its behaviour by identifying the input for the

algorithm increases or decreases. Asymptotic notations are said as the

mathematical tools which is used to represent time complexity of

algorithms.

WHY DO WE NEED TO USE ASYMPTOTIC

NOTATION?

So, till now we have read about asymptotic notation that it is a tool to

analyse an algorithm’s complexities for change in input size. But the

question that arises after reading about what is asymptotic notation that is

what is the need to use asymptotic notation?

These following points may be helpful in giving us a more clear idea about

the need to use Asymptotic notations-

characterizing them in terms of their efficiency.

It is characterized as how long computer takes to run the lines of program,

and that depends on the speed of the computer, the programming

language, and the compiler that translates the program.

The area of focus in order to characterize is that how fast a function grows

with input size and this is known as rate of growth.

Therefore we need to establish a way to talk about rate of growth of

functions so that we can compare algorithms.

Here comes Asymptotic notation into play that gives us a method for

classifying functions according to their rate of growth.

understand an algorithm more clearly and helps us to classify functions

according to their rate of growth.

WAYS TO CLASSIFY ASYMPTOTIC

NOTATION

different ways. Few examples are that one can describe an algorithm by its

best case, worse case, or equivalent case. By these cases we mean-

Best Case − Minimum time taken by the program to get executed.

typically don’t evaluate by best case because those conditions aren’t what

we’re planning for by that we means that if our program is ready for worst

case that can happen we automatically can safeguard it from the average

and best cases, we always should be prepared for worst thing that could

happen even in our daily life. A very good example of this is sorting

algorithms specifically, adding elements to a tree structure. Best case for

most of the algorithms can be as low as a single operation. However, in most

cases, the element we’re adding will need to be sorted appropriately through

the tree, which could mean examining an entire branch. This is the worst

case, and this is what we plan for.

CLASSIFICATION OF ASYMPTOTIC

NOTATIONS

ϴ-Notation (Theta).

Now , let’s take a look at each of them step by step that what they are and

how they work and what are their uses and what do we usual take into

consideration more.

BIG O NOTATION-

Some key points about Big O are-

The Big O notation is an upper bound of an algorithm and it bounds a

function only from the above.

It is said as Asymptotic Notation for the worst case or ceiling of growth

for a given function.

In simple language it can be said as a way to estimate upper limit of a

function when the input given is very large.

O(g(n)) = {

f(n): there exist positive constants c and

k such that 0 ≤ f(n) ≤ cg(n) for

all n ≥ k

}

In above mathematical format, we have chosen an arbitrary constant ‘k’ as a

standard for large input meaning if our input is considered to be large only

when n ≥ k. After that, we have defined the upper bound for the function f(n)

with the help of a function g(n) and constant c. It means that our function

f(n)’s value will always be less than or equal to c * g(n) where g(n) could be

any non-negative function for all sufficiently large value of n.

Big Oh notation is one of the most widely used notation for finding time

complexity because it usually deals with the upper bound of an algorithm

which helps us to decide which algorithm would be better. For Example:

algorithm of complexity O(n) will do better than algorithm of complexity O(n²)

for sufficiently large input(it may not be true when input is small).

When we say that the running time is "big-O of f(n)” or just "O of f(n)” We

use big-O notation for asymptotic upper bounds, since it is meant to

bound the growth of the running time from above for large enough input

sizes.

BIG OMEGA (Ω) NOTATION-

The Big Omega notation is an lower bound of an algorithm and it

provides an asymptotic lower bound.

It is said as Asymptotic Notation for the best case or floor of growth for a

given function.

It is nothing but the reverse of Big Oh.

Ω (g(n)) =

In above mathematical format we can see that the value of function is always

greater than or equal to lower bound which means c * g(n).

Omega notation is widely used when one is interested in the least amount of

time required for the function/algorithm which makes it one of the least

used notation in comparison to other notations.

certain amount of time, without even providing an upper bound. We use big-

Ω notation and is derived from greek letter "omega."

We would say that the running time is "big-Ω of f(n).We are using big-Ω

notation for asymptotic lower bounds, as it bounds the growth of the

running time from below for large enough input sizes.

One can also make accurate but imprecise statements from big-Ω notation.

For example: if we have one lakh rupees in our pocket, we can truthfully say

"I have an amount of money in my pocket, and it's at least 10 rupees." That

is correct, but certainly not very precise.

𝜃-NOTATION(THETA):

The theta notation is used to describe the asymptotic efficiency of

algorithms. ... For set membership, we write h(n)=Θ(f(n)) and not

h(n)∈Θ(f(n)) .

Mathematically it can be written as:

that 0 <= c1*g(n) <= f(n) <= c2*g(n) for all n >= n0}

The theta notation bounds a functions from above and below, so it defines

exact asymptotic behaviour .A simple way to get Theta notation of an

expression is to drop low order terms and ignore leading constants. For

example, consider the following expression.

Dropping lower order terms is always fine because there will always be a n0

after which Θ(n3) has higher values than Θn2) irrespective of the constants

involved.

For a given function g(n), we denote Θ(g(n)) is following set of functions.

The above definition means, if f(n) is theta of g(n), then the value f(n) is

always between k1*g(n) and k2*g(n) for large values of n (n >= n0). The

definition of theta also requires that f(n) must be non negative for values of n

greater than n0.

Example:

2 2

If n +3n+4=Θ(n )

Proof:

When n ≥ 1, n2 + 3n + 4 ≤ n2+ 3n2+ 4n2 ≤ 8n2

• When n ≥ 0, n2 ≤ n2 + 3n + 4

• Thus, when n ≥ 1 1n 2 ≤ n2 + 3n + 3 ≤ 8n2

2

Thus, we have shown that n2+3n+4= Θ(n )

SMALL o NOTATION:

the upper bound (that is not asymptotically tight) on the growth rate

of runtime of an algorithm.

f(n) is o(g(n)), if for all real constants c (c > 0) and n0 (n0 > 0), f(n) is < c

g(n) for every input size n (n > n0).

The definitions of O-notation and o-notation are similar. The main

difference is that in f(n) = O(g(n)), the bound f(n) <= g(n) holds

for some constant c > 0, but in f(n) = o(g(n)), the bound f(n) < c g(n)

holds for all constants c > 0.

Let f(n) and g(n) be functions that map positive integers to positive real

numbers. We say that f(n) is ο(g(n)) (or f(n) Ε ο(g(n))) if for any real constant c

> 0, there exists an integer constant n0 ≥ 1 such that 0 ≤ f(n) < c*g(n).

Mathematically it can be written as:

f(n)=o(g(n))

means

limf(n)/g(n)=0

n→∞

Examples:

Is 6n + 7 ∈ o(n2)?

In order for that to be true, for any c, we have to be able to find an n0 that

makes

f(n) < c * g(n) asymptotically true.

If c = 100,we check the inequality is clearly true. If c = 1/100 , we’ll have to use

a little more imagination, but we’ll be able to find an n0. (Try n0 = 1000.) From

these examples, the conjecture appears to be correct.

then check limits,

lim f(n)/g(n) = lim (6n + 7)/(n2) = lim 6/2n = 0 (l’hospital)

n→∞ n→∞ n→∞

SMALL ω NOTATION:

denote the lower bound (that is not asymptotically tight) on the growth

rate of runtime of an algorithm.

f(n) is ω(g(n)), if for all real constants c (c > 0) and n0 (n0 > 0), f(n) is > c

g(n) for every input size n (n > n0).

The definitions of Ω-notation and ω-notation are similar. The main

difference is that in f(n) = Ω(g(n)), the bound f(n) >= g(n) holds

for some constant c > 0, but in f(n) = ω(g(n)), the bound f(n) > c g(n)

holds for all constants c > 0.

Mathematically it can be written as:

if f(n) ∈ ω(g(n))

then,

lim f(n)/g(n)=∞

n→∞

Let f(n) and g(n) be functions that map positive integers to positive real

numbers. We say that f(n) is ω(g(n)) (or f(n) ∈ ω(g(n))) if for any real constant

c > 0, there exists an integer constant n0 ≥ 1 such that f(n) > c * g(n) ≥ 0 for

every integer n ≥ n0.

f(n) has a higher growth rate than g(n) so main difference between Big

Omega (Ω) and little omega (ω) lies in their definitions.In the case of Big

Omega f(n)=Ω(g(n)) and the bound is 0<=cg(n)<=f(n), but in case of little

omega, it is true for 0<=c*g(n)<f(n).

Example:

3n+5 ∈ ω(1);

the little omega(ο) running time can be proven by applying limit formula

given below.

n→∞

lim (3n+5)/(1) = ∞

n→∞

and,also for any c we can get n0 for this inequality 0 <= c*g(n) < f(n), 0 <=

c*1 < 3n+5

Hence proved.

MULTIPLE CHOICE QUESTIONS ABOUT ASYMPTOTIC

NOTATION:

1.For the functions, n^k and c^n, what is the asymptotic relationship

between these functions? Assume that k >= 1 and c > 1 are constants.

2.) For the functions, lgn and log_8n, what is the asymptotic relationship

between these functions?

a.)lgn is O(log_8n)

b.)lgn is Ω(log_8n)

c.)lgn is Θ(log_8n)

3.) For the functions log2 n and log8 n what is the asymptotic relationship

between these functions?

required by it during execution.

a.) Time

b.) operations

c.) Memory space

d.) None of the above

the size of input. State if the statement is True or False or Maybe.

a.) True

b) false

c) maybe

d) none of the above

6.)For many problems such as sorting, there are many choices of algorithms

to use, some of which are extremely___________.

a.) space efficient

b.) time efficient

c.) both a and b

d.) None of them

a.) Text analysis

b.) Growth factor

c.) Time

d.) None of the above

8.) To verify whether a function grows faster or slower than the other

function, we have some asymptotic or mathematical notations, which

is_________.

a.) Big Omega Ω (f)

b.) Big Theta θ (f)

c.) Big Oh O (f)

d.) All of the above

9.) A function in which f(n) is Ω(g(n)), if there exist positive values k and c

such that f(n)>=c*g(n), for all n>=k. This notation defines a lower bound for a

function f(n):

a.) Big Omega Ω (f)

b.) Big Theta θ (f)

c.) Big Oh O (f)

d.) All of the above

10.) An algorithm that indicates the amount of temporary storage required

for running the algorithm, i.e., the amount of memory needed by the

algorithm to run to completion is termed as_____.

a.) Big Omega Ω (f)

b.) Big Theta θ (f)

c.) Big Oh O (f)

d.) All of the above

NOTATION

1.)An algorithm performs lesser number of operations when the size of input

is small, but performs more operations when the size of input gets larger.

State if the statement is True or False or Maybe.

a.) True

b) false

c) maybe

d) none of the above

the size of input. State if the statement is True or False or Maybe.

a.) True

b) false

c) maybe

d) none of the above

Decide whether these statements are True or False. You must briefly justify

all your answers to receive full credit.

a.) True

b) false

c) maybe

d) none of the above

a.) True

b) false

c) maybe

d) none of the above

a.) True

b) false

c) maybe

d) none of the above

a.) True

b) false

c) maybe

d) none of the above

where f(n) is defined to be the running time of the program A(n): def A(n):

atuple = tuple(range(0, n)) # a tuple is an immutable version of a # list, so

we can hash it S = set() for i in range(0, n): for j in range(i+1, n):

S.add(atuple[i:j]) # add tuple (i,...,j-1) to set S

a.) True

b) false

c) maybe

d) none of the above

- FOCSps6Hochgeladen vonjohn
- Cycle Test I_keyHochgeladen vonPooja Sinha
- Algorithm-Analysis.pptHochgeladen vonmeryamreza
- 2.3. Big-O Notation — Problem Solving With Algorithms and Data StructuresHochgeladen vonErr33
- Double Sat 1Hochgeladen vonJorge Alejandro
- C04.AlgorithmAnalysisHochgeladen vonSameer Husain
- 5 KOMPLEKSITAS ALGORITMAHochgeladen vonlaharadeo
- unit1-spHochgeladen vonhrsli
- Introduction of ArithmeticHochgeladen vonSaraswathy Vinayakamurthy
- common math outline ivm 12-13Hochgeladen vonapi-41591817
- A 3_2 Algorithm for Two-Machine - A 3-2 Algorithm for Two-MachineHochgeladen vonAngel Cotera
- Chapter_02 Fundamental AnalysisHochgeladen vonNipaporn Tanny Thipmanee
- Maths LecturerHochgeladen vonmaruthi631
- Lynda_PMP_ Communication Channels QuestionsHochgeladen vonSatish Raghupathi
- 1Hochgeladen vonmk8580123
- Unlock Scilab13Hochgeladen vondjatoyz
- DM-Intro 16.0 L04 Geometry ModelingHochgeladen vonHüseyin Suzuk
- Maths-1Hochgeladen vonAnonymous dxUMukLvv
- Data Structure NotesHochgeladen vonRamneet Parmar
- Wikipedi Mathematical FinanceHochgeladen vonali adnan
- Lines PlanHochgeladen vonJeesonAntony
- fa 2 syllabus class vHochgeladen vonapi-200331452
- (2016-MC-02).pptxHochgeladen vonUsama Asim
- Holder SpacesHochgeladen vonManuel Argomedo Salirrosas
- Ah Sem 1Hochgeladen vonJASON_INGHAM
- Computer Science-Lecture 9-Final IssuesHochgeladen vonAshley Anderson
- Multi Point a PxHochgeladen vonPedro Luis Carro
- FftHochgeladen vonSangeeta Kadambala
- A Survey on the Traveling Salesman ProblemHochgeladen vonJeremy Li
- brkgaAPIHochgeladen vonEmanuel Diego

- Tl the Cloud and SOAHochgeladen vonroswan
- 2. TQM course content.pptxHochgeladen vonCriseldo Calinawan
- Shipping Container Homes Individual Book 11Hochgeladen vonAndres H. Acevedo
- Photo Print SizesHochgeladen vonArvic Omila Lasaca
- Electrical Engineer Job Description Electrical Engineer %7c Job Description Template EnHochgeladen vonMaya Ashok
- SE Myth of SoftwareHochgeladen vonPrakash Paudel
- RTSOTS238 538 630(H) Series User Manual (V1.0e)Hochgeladen vonElaine Gisell Caro Mendez
- FiltersHochgeladen vonAnuradhi Welhenge
- Week 06 - DQ - PMLC modelsHochgeladen vonguillermodiscos
- objectiv question answer of computerHochgeladen vonapi-320326008
- Experiment-1 Ohm's LawHochgeladen vonaaa
- Water level indicator cum controllerHochgeladen vonSunil Kumar Kushwaha
- Kevin Tam ResumeHochgeladen vonKevin Tam
- FG85Hochgeladen vonpapajoel82
- 2016 Sonic Owners ManualHochgeladen vonedmexia
- Senheister InstructionsHochgeladen vonRob Reid
- STUDY OF INDUSTRIAL HYDRAULICS AND REDUCTION CASSETTE HYDRAULIC RELATED PROBLEMSHochgeladen vonPrudhvi
- F5 302 - Study Guide - GTM SpecialistHochgeladen vondjmckc
- Ossulston Street Early Lcc Experiments in High Rise Housing 1925 29Hochgeladen vonGillian Wardell
- Nitson Kymore CPP ERECTION DEVIATIONHochgeladen voncvsrikala
- Rutherford F4104-08-32D Data SheetHochgeladen vonJMAC Supply
- SEPAM Group ProfileHochgeladen vonSelva Kumar
- Enigma PricelistHochgeladen vonMarilou Loque Mariano
- Airfoil.docxHochgeladen vonMahendranath Ramakrishnan
- COA PCTHochgeladen vonMuhamad Aulia Rahman
- Social audit guidelines and toolkit, RAY IHSDP.pdfHochgeladen vonjanani1990
- Thesis Chapter 4 & 5Hochgeladen vonMcBilly Wilford Sy
- shure_m95edHochgeladen vonpeterdavies9
- 16909_New Survey Lab ManualHochgeladen vonMohit Verma
- Analisis de Pavimento No Destructivo Basado en DeflexionHochgeladen vonWilfredo Tejerina

## Viel mehr als nur Dokumente.

Entdecken, was Scribd alles zu bieten hat, inklusive Bücher und Hörbücher von großen Verlagen.

Jederzeit kündbar.