2 views

Uploaded by Ebony Miller

- Bars Sliders and Spinners
- Complexity Space n Time
- If Not Assigned a Value
- Classes & Objects
- Cs6402 Design and Analysis of Algorithms Appasami Lecture Notes
- RAOTM 2017 - L07 - Micro800 PLC Programming With Connected Components Workbench Software - Manual (002)
- project 1 c
- Intro to c Programming for Robotics
- OpenGL
- Random Numbers
- Course File CSE 6th Sem DAA
- C Programming Module 1 C Programming Basic
- Modeling and Characterization of Vegetation, Aquatic and Mineral Surfaces Using the Theory of Plausible and Paradoxical Reasoning from Satellite Images: Case of the Toumodi-Yamoussoukro-Tiébissou Zone in V Baoulé (Côte d’Ivoire)
- Asymptotic Notation1.ppt
- CPU12RM
- The Espial- Online Debugging
- G01 TLBO
- One Page Project Management Template
- 232796635-SERV2-03E-Data-Blocks.pdf
- CSC108_TT2EV_2010F

You are on page 1of 2

ossische

Technische Hochschule

Z

urich

Politecnico federale di Zurigo

Federal Institute of Technology at Zurich

Institut f

ur Theoretische Informatik

Peter Widmayer

Tobias Proger

Thomas Tschager

Exercise Sheet 1

FS 15

There is a definition of the O notation that is different from the one given at the lecture. Namely,

for a function g : N R+ , let

O(g) := {f : N R+ | c R+ , n0 N n n0 : f (n) cg(n)}.

(1)

with

(g) := {f : N R+ | c R+ , n0 N n n0 : f (n) cg(n)}.

(2)

A function f grows asymptotically like g when f O(g) and f (g). We denote this by

f (g), or as f = (g).

For these exercises, you can choose to use the definition given at the lecture, or use the above

definition.

Exercise 1.1

Give a definition of the set (g) as compactly as possible (i.e., with the fewest possible parameters and quantifiers), analogously to the above definitions for the sets O(g) and (g).

Exercise 1.2

a) f O(g) if and only if g (f ).

b) If f O(g), then f (n) g(n) for

every n N.

c) If f (n) g(n) for every n N, then

f O(g).

d) There exist different functions f and

g such that f (g) and g (f ).

Exercise 1.3

N\{1}.

f) Let f1 , f2 O(g) and f (n) := f1 (n) + f2 (n).

Then, f O(g).

g) Let f1 , f2 O(g) and f (n) := f1 (n) f2 (n).

Then, f O(g).

h) nd O(bn ) for fixed values d > 0 and b > 1

Sort the following functions from left to right such that: if function f is on the left of g, then

f O(g).

Example: the functions n3 , n7 , n9 are already in the right order since n3 O(n7 ) and n7 O(n9 ).

2n

n

1

11

n

7

n

log(n ), 2 , n!, n , 15 , n, 2 , log(n!),

, , log8 (n)

n

2

n

Please turn over.

Exercise 1.4

Programming Exercise.

if n = 0

A

Rn = B

if n = 1 ,

i.e. we want to compute Ri for a given i N. For example, if A = 0, B = 1, C = 1 and D = 1,

then Rn produces the well-known Fibonacci numbers 0, 1, 1, 2, 3, 5, 8, 13, . . .

Input The first line of the input contains only the number t of test instances. After that, we

have exactly one line for each test instance containing the numbers i, A, B, C, D (in exactly

this order, separated by spaces). While 0 i 50 is a natural number, A and B are integers

from the interval [103 , 103 ], and C and D are either 1 or 1.

Output

For every test instance, we want to output a single line containing only the value Ri .

Example

Input:

2

20 0 1 1 1

22 5 10 1 -1

Output:

6765

-10

Notes

1) The values Ri can be very large. You should use the data type long instead of int.

2) To read an input from the console you can import the class java.util.Scanner and use

the following code fragment:

Scanner in = new Scanner(System.in);

int value1 = in.nextInt();

int value2 = in.nextInt();

2

- Bars Sliders and SpinnersUploaded bywilsonrao
- Complexity Space n TimeUploaded byapi-3814408
- If Not Assigned a ValueUploaded byravimodekar
- Classes & ObjectsUploaded bysimargrewal
- Cs6402 Design and Analysis of Algorithms Appasami Lecture NotesUploaded byappasami
- RAOTM 2017 - L07 - Micro800 PLC Programming With Connected Components Workbench Software - Manual (002)Uploaded byHuy Tran
- project 1 cUploaded byapi-248273754
- Intro to c Programming for RoboticsUploaded byklamja83
- OpenGLUploaded bySmita Sajjan
- Random NumbersUploaded byMohammed Aliraqi
- Course File CSE 6th Sem DAAUploaded bybias bhadra
- C Programming Module 1 C Programming BasicUploaded byJm Potenciando
- Modeling and Characterization of Vegetation, Aquatic and Mineral Surfaces Using the Theory of Plausible and Paradoxical Reasoning from Satellite Images: Case of the Toumodi-Yamoussoukro-Tiébissou Zone in V Baoulé (Côte d’Ivoire)Uploaded byMia Amalia
- Asymptotic Notation1.pptUploaded byRohit Chahal
- CPU12RMUploaded byMASTERJORGITOCRUZ
- The Espial- Online DebuggingUploaded bysanjiv199444
- G01 TLBOUploaded byGabriela Piroșcă
- One Page Project Management TemplateUploaded byKabul Abdullah
- 232796635-SERV2-03E-Data-Blocks.pdfUploaded byKhaled Ouni
- CSC108_TT2EV_2010FUploaded byexamkiller
- c tutorialUploaded byPachEncho
- Data Structures and Algorithms ArraysUploaded byHisham Thorakkal
- JSR 296 From the Trenches 08 2008Uploaded bymishascribd
- JavaUploaded bySteffany Joy Moreno Desamito
- 03 Intro Eiffel Part1Uploaded byNacho Castagneris
- LogInSkin.txtUploaded byMiinoP
- Array OperationsUploaded byRex Geopano
- Computer 3Uploaded byZakwan Nasir
- 731-786-1-PBUploaded byDiamond Planet
- Iterator pattern ImplemantationUploaded bySharad Kumbharana

- Cluster_Diagnostic_Study___Marble_15th_May__2006_1_.pdfUploaded byaeioums4391
- SMS Call flow , GSM , SMSC call flow, SMSCG detailUploaded byKhushwant Negi
- CFD simulation and emissions prediction from a helicopter engineUploaded byjuuza70
- 4. Reconfigurable Sequence DetectionUploaded byHitesh Prasad
- Make Your Own Spectroscope FINALUploaded byAnge Quintriqueo
- Introduction_to_AutoCAD_and_Civil_3D.pptxUploaded byMuhammad Junaid
- Chapter 9F - The FAA FolliesUploaded byGTX357-Bruce Gorcyca Book Manuscripts
- Flash Cs5 HelpUploaded byCedrick Tolentino
- Manual de Servicio Sensores Ws24Uploaded byManuel Solar Rigoni
- Field Scale Geomechanical Modelling Using AbaqusUploaded byYUSUF
- 51749_AOD450LUploaded byluispider74
- Laboratory and Oilfield Experiments of a Fast 04535893Uploaded byHanif Halim
- 52. IS 456-2000Uploaded byhhr2412
- m02res01Uploaded byJagdish Modi
- OmmUploaded bySajjad Hossain
- Roland MODELA MDX-15 MDX-20 Service Notes Manual [Sm,Pm,CD] 200512 1 Qmanual.comUploaded bylatrua
- ford.docxUploaded bybhaktishah117
- A Buck-Boost Converter through an Induction Motor with Diode Clamped Multilevel Inverter for Non-Conventional Energy SourcesUploaded byAnonymous vQrJlEN
- aggadydizzy1.pdfUploaded byMihaela Manuela
- 1600 ManualUploaded bypraseedav
- 2853_Op_ManUploaded byGeorge Iulian
- AER710 ProjectUploaded byArvi Domingo
- Sol 11 3 Repo Md5sumsUploaded byramalingam_dec
- Chemistry XII 2011 12Uploaded byPrasad Yarra
- Chapter 5 Large and Fast Exploiting Memory HierarchyUploaded bylekhanasri
- syllabus3.pdfUploaded byajee
- Citizen - Blue Angle.pdfUploaded bylfsroseiro
- R1300GUploaded byPedro Pablo Fernández Fernández
- Ps1 GeneralUploaded bykulin123456
- PBC VF Template Developer and Sr Dev - Mar15 v1.1Uploaded byAnonymous GMQKYb