37 views

Original Title: Tut1

Uploaded by dreamylove_tn

Tut1

Attribution Non-Commercial (BY-NC)

- Algorithmic Complexity in Real Financial Markets
- Algorithms and Complexity
- Computational Complexity - Christos Papadimitriou.pdf
- M1 Data Structures
- Data Structures Questions Part 1 _ Amcatblog
- Introduction to Data Structures
- c4-r3: Algorithm Analysis and Design Note: 1.
- Assymptotic Notations
- LSP039.Online Notice Board
- bca iv sem ada qb
- AsymptoticAnalysis 1
- chapter 7 toc
- MLD for linear MIMO channel.pdf
- Additional Reading Algorithm Efficiency
- A Unique Sorting Algorithm With Linear Time & Space Complexity
- Theory of Computation
- Graph
- Week 1
- Single Sched
- Algorithms and Complexity Analysis

You are on page 1of 4

Required Questions Question 1. Reorder the following efficiencies from the smallest to the largest: 2n log(n2); 5n6; 22013; 2.5n; 2.2n; 2n6.5; log(n10); 4 log(n); 2100; n1.03; 70n; n log n; 8n6 + 5n2 Question 2. Determine the big-O notation for the following: a. 2n9 b. 100n + 10.5n2/3 + 5.2n7/5 c. 19log2(n) d. 5n10 + 2logn e. n! + k! (k is a predefined constant) f. 100log2(n) + 5(n+2n) Question 3. Calculate the run-time efficiency of the following program segment:

1 i = n-1 2 loop (i >= n/3) 1 j = 1 2 loop (j < n/3) 1 print(i, j) 2 j = j + 3

Question 4. If the algorithm doIt has an efficiency factor of n2, calculate the run time efficiency of the following program segment: 1i=1 2 loop (i <= n) 1j=1 2 loop (j <= n) 1k=1 2 loop (k <= n) 1 doIt() 2k=k +2 3 end loop 4j=j*2 3 end loop 4i=i+1 3 end loop

Question 5. Given that the efficiency of an algorithm is 3nlog2(n3), if a step in this algorithm takes 1 nanosecond (10-9), how long does it take the algorithm to process an input of size 1024? Question 6. Write a recurrence equation for the running time T(n) of g(n), and solve that recurrence. Algorithm g (val n <integer>) Pre n must be greater than 0 Return integer value of g corresponding to n 1 if (n = 1) 1 return 2 2 else 1 return g(n 1)+ 2 End g

Advanced Questions Question 7. Prove that for any positive functions f and g, f(n) + g(n) and max(f(n), g(n)) are asymptotically equivalent (i.e. they yield the same big-O notations). Question 8.

Estimating the time complexity of the following program segment: 1i=0 2 loop (i < N) 1j=i 2 loop (j < N) 1k=0 2 loop (k < M) 1x=0 2 loop (x < K) 1 print(i, j, k) 2x=x+3 3 end loop 4k=k+1 3 end loop 4k=0 5 loop (k < 2*K) 1 print(k) 2k=k+1 6 end loop 7j=j+1 3 end loop 4i=i+1 3 end loop Question 9. Calculate the run-time efficiency of the following program segment: 1i=n 2 k = n/3 3 loop (i >= k) 1 j = n 3*k 2 loop (j < i) 1 print(i, j) 2j=j+3 3 end loop 4i=i-1 4 end loop Question 10. Give the best asymptotic (big-Oh) characterization of the best and worst case time complexity of the algorithm Count(A;B; n). Explain how you computed the complexity. Algorithm Count(A,B,n) Input: Arrays A and B of size n, where n is even. A, B store integers. i=0 sum = 0

while i <n/2 do if A[i + n/2 ] < 0 then for j = i+n/2 to n do sum = sum+B[j] i = i+1 return sum Question 11. Let A be an array storing positive integers. Write in pseudocode an algorithm that rearranges the elements of A so that the odd elements appear before the even elements. For example, if the input to the algorithm is an array A = {4; 5; 2; 9; 2}, and example of a valid output is A = {5; 9; 4; 2; 2}. Other outputs, for example A = {5; 9; 2; 2; 4}, are also valid, as long as the odd elements appear before the even ones. Compute the time complexity of your algorithm in the worst case. Explain how you computed complexity. Most likely, your complexity will be not linear. At the end of the course, we will learn a linear time algorithm for this problem. Question 12. Write a recurrence equation for the running time T(n) of f(n), and solve that recurrence.

Algorithm f (val n <integer>) Pre n must be greater than 0 Return integer value of f corresponding to n 1 if (n <= 1) 1 return 1 2 else 1 return f(n 1) + f(n 2) End

- Algorithmic Complexity in Real Financial MarketsUploaded byemerzak
- Algorithms and ComplexityUploaded byJulien Noblet
- Computational Complexity - Christos Papadimitriou.pdfUploaded byf
- M1 Data StructuresUploaded byresmi_ng
- Data Structures Questions Part 1 _ AmcatblogUploaded byVishnu Kumar
- Introduction to Data StructuresUploaded byRiteshRaj
- c4-r3: Algorithm Analysis and Design Note: 1.Uploaded byvikassonwal
- Assymptotic NotationsUploaded byAhmed Ajmal
- LSP039.Online Notice BoardUploaded byYuvika YuvRaj Bisht
- bca iv sem ada qbUploaded byapi-285363432
- AsymptoticAnalysis 1Uploaded byvivek patel
- chapter 7 tocUploaded byYubraj Chaudhary
- MLD for linear MIMO channel.pdfUploaded byMuhammad Firdaus
- Additional Reading Algorithm EfficiencyUploaded byANIRUDDHA PAUL
- A Unique Sorting Algorithm With Linear Time & Space ComplexityUploaded byesatjournals
- Theory of ComputationUploaded byRehan Shabbir
- GraphUploaded bybogdan_118
- Week 1Uploaded byhelloibrahim
- Single SchedUploaded bysagarbolisetti
- Algorithms and Complexity AnalysisUploaded bylawal
- Scimakelatex.338.PopeyUploaded bymaxxflyy
- Defence FinalUploaded bySpandana Ram
- M.tech Information Systems Syllabus.pdfUploaded byShishir Oraon
- Module%201%20Data%20Structures%20Theory%20syllabus%202002%20onwards[1]Uploaded byambilichandran
- AlgoUploaded bySantosh Parvatikar
- Unit03_ComplexityAnalysis1Uploaded byrutvij111
- Data Structure1Uploaded byJatinChadha
- q.pdfUploaded byShailesh Prajapati
- smm-pe-textos-2009-v11Uploaded byMario Marin
- Meaningful Learning through Identifying Differences and Similarities between Certain Problems and AlgorithmsUploaded byAsif Tasleem

- ISO 128-20 Technical Drawings General Principles of PresentationUploaded byindiannewton
- Jin-Ho Park, Jack Sindener - On Housing Flexibility (...)(Paper)Uploaded byRoger Krieger
- Disadvantages of an Elite EducationUploaded bycolaya
- 070.650-SPL_SGC_2014-01Uploaded byMark DeMateo
- Clustering and Classification of Cancer Data Using Soft Computing TechniqueUploaded byInternational Organization of Scientific Research (IOSR)
- Pipeline Report SummaryUploaded byTamara Payne
- Draw a Lgt Form 09 Showing Estimate of Capital ExpenditureUploaded byKAYODE OLADIPUPO
- Cambridge English First Use of English Part 4 With AnswersUploaded byMonika Perez
- An Ordinary of Arms 1895Uploaded byGeordie Winkle
- Spray Modelling Using AnsysUploaded bytumoye
- RBB CLERK PRE 2017(Memory Based) SolutionUploaded bySpecule
- PLDT DSLUploaded byChristan Calvarido
- Internship Report(Rough Draft)Uploaded by037-061
- ACB SparesUploaded byVikas Yadav
- 1.pdfUploaded byBenji Alvarez Diaz
- DEFENCE: An Analysis of a SEVENTH-DAY ADVENTIST Offensive Against JEHOVAH'S WITNESSESUploaded byGary Strange
- Roll of Quantity SurveyorUploaded bySahadevan Nair
- Aromatization of Ethanol on Mo2CZSMUploaded byKristof Van der Borght
- Comparative AnatomyUploaded bySamantha Arda
- How to Understand Revelation - Dave MathewsonUploaded bySamVanEerden
- A Study on the Integration Features of Learning DomainUploaded byzapel
- Buyers Guide Blood Pressure MonitorsUploaded byAnonymous t0HdWfGbl
- BORANG C - English for FrontlinersUploaded byDamien Jombek
- GFCO Product - Ingredient List TemplateUploaded byokoko
- Price UltihihgUploaded byjudg
- LC7218 PLL Frequency Synthesiser for Electronic Tuning in AV Systems DatasheetUploaded by57 varieties
- Usb Epic Manv3.2Uploaded byybourini
- Differences Between Biclustering and ClusteringUploaded byLogenthiran Machap
- manufacturing company-statement-Uploaded bykuningan
- Cyclic Concept of NatureUploaded byJessica Prias Moscardon