Algorithms CSCI 235, Spring 2019 Lecture 12 Midterm I Review

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

Analysis of Algorithms CS 477/677 Randomizing Quicksort Instructor: George Bebis (Appendix C.2, Appendix C.3) (Chapter 5, Chapter 7)
1 ICS 353 Design and Analysis of Algorithms Spring Semester (062) King Fahd University of Petroleum & Minerals Information & Computer Science.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu.
Analysis of Algorithms CS 477/677 Midterm Exam Review Instructor: George Bebis.
Lecture 4 Sept 4 Goals: chapter 1 (completion) 1-d array examples Selection sorting Insertion sorting Max subsequence sum Algorithm analysis (Chapter 2)
Analysis of Algorithms 7/2/2015CS202 - Fundamentals of Computer Science II1.
Analysis of Algorithms Spring 2015CS202 - Fundamentals of Computer Science II1.
David Luebke 1 8/17/2015 CS 332: Algorithms Asymptotic Performance.
CSE 5311 DESIGN AND ANALYSIS OF ALGORITHMS. Definitions of Algorithm A mathematical relation between an observed quantity and a variable used in a step-by-step.
Probability Distributions. A sample space is the set of all possible outcomes in a distribution. Distributions can be discrete or continuous.
Asymptotic Notations Iterative Algorithms and their analysis
Probability Review Part I Design and Analysis of Algorithms I.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Discrete Random Variables Chapter 4.
Time Complexity Dr. Jicheng Fu Department of Computer Science University of Central Oklahoma.
Lecture 8. How to Form Recursive relations 1. Recap Asymptotic analysis helps to highlight the order of growth of functions to compare algorithms Common.
Mathematics Review and Asymptotic Notation
Probability Distributions - Discrete Random Variables Outcomes and Events.
Design and Analysis of Algorithms - Chapter 21 Analysis of Algorithms b Issues: CorrectnessCorrectness Time efficiencyTime efficiency Space efficiencySpace.
BY Lecturer: Aisha Dawood.  stands alone on the right-hand side of an equation (or inequality), example : n = O(n 2 ). means set membership :n ∈ O(n.
4.1 Probability Distributions. Do you remember? Relative Frequency Histogram.
Chapter 5.1 Probability Distributions.  A variable is defined as a characteristic or attribute that can assume different values.  Recall that a variable.
A Lecture /24/2015 COSC3101A: Design and Analysis of Algorithms Tianying Ji Lecture 1.
Week 12 - Wednesday.  What did we talk about last time?  Asymptotic notation.
Lecture 2 Review Probabilities Probability Distributions Normal probability distributions Sampling distributions and estimation.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 7.
David Luebke 1 1/6/2016 CS 332: Algorithms Asymptotic Performance.
Asymptotic Performance. Review: Asymptotic Performance Asymptotic performance: How does algorithm behave as the problem size gets very large? Running.
1 Algorithms CSCI 235, Fall 2015 Lecture 6 Recurrences.
Master Method (4. 3) Recurrent formula T(n) = a  T(n/b) + f(n) 1) if for some  > 0 then 2) if then 3) if for some  > 0 and a  f(n/b)  c  f(n) for.
A Introduction to Computing II Lecture 5: Complexity of Algorithms Fall Session 2000.
Probability and Simulation The Study of Randomness.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Analysis of Algorithms & Recurrence Relations. Recursive Algorithms Definition –An algorithm that calls itself Components of a recursive algorithm 1.Base.
Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University.
Analysis of Algorithms Spring 2016CS202 - Fundamentals of Computer Science II1.
Algorithmic Foundations COMP108 COMP108 Algorithmic Foundations Algorithm efficiency Prudence Wong.
CSCI 6212 Design and Analysis of Algorithms Which algorithm is better ? Dr. Juman Byun The George Washington University Please drop this course if you.
Algorithmic Foundations COMP108 COMP108 Algorithmic Foundations Algorithm efficiency Prudence Wong
Design and Analysis of Algorithms
Analysis of Algorithms
COMP108 Algorithmic Foundations Algorithm efficiency
Analysis of Algorithms
CS 3343: Analysis of Algorithms
Algorithms CSCI 235, Fall 2017 Lecture 12 Midterm I Review
CS 3343: Analysis of Algorithms
CS 3343: Analysis of Algorithms
i206: Lecture 8: Sorting and Analysis of Algorithms
CS 3343: Analysis of Algorithms
Asymptotic Notations Algorithms Lecture 9.
CS 3343: Analysis of Algorithms
CS 583 Analysis of Algorithms
Advance Analysis of Lecture No 9 Institute of Southern Punjab Multan
CSC 413/513: Intro to Algorithms
Algorithm Efficiency Chapter 10.
CS 3343: Analysis of Algorithms
Master Method (4. 3) Recurrent formula T(n) = aT(n/b) + f(n)
Analysis of Algorithms
Analysis of Algorithms
CONDITIONAL PROBABILITY
Lecture 23 Section Mon, Oct 25, 2004
Algorithms CSCI 235, Spring 2019 Lecture 7 Recurrences II
Algorithms Recurrences.
Algorithms CSCI 235, Spring 2019 Lecture 3 Asymptotic Analysis
Algorithms CSCI 235, Spring 2019 Lecture 2 Introduction to Asymptotic Analysis Read Ch. 2 and 3 of Text 1.
Algorithms CSCI 235, Spring 2019 Lecture 6 Recurrences
Algorithms CSCI 235, Spring 2019 Lecture 8 Recurrences III
Algorithms CSCI 235, Spring 2019 Lecture 17 Quick Sort II
Analysis of Algorithms CS 477/677
Analysis of Algorithms
Presentation transcript:

Algorithms CSCI 235, Spring 2019 Lecture 12 Midterm I Review

Problem 1: Running time of iterative algorithms 1. Find the running time of the following algorithms: (a) sample(A, n) sum = 0 for i = 1 to n do for j = 1 to n do for k = 1 to n/2 do sum = sum + A[i, j, k] (b) foo(n) for j = 1 to i do print i*n + j

Problem 2: Recurrence Equations Find the running time of the following algorithms: (a) fib(x) if x = 0 or x = 1 then return 1 else return fib(x-1) + fib(x -2) (b) review(n) exam(n) //assume this runs in Q(n) time review(n/3)

Analyzing algorithms Know how to find the running time of recursive algorithms. Know how to find the running time of iterative algorithms (e.g. Insertion sort from lecture 2). Find the number of times a comparison is executed. Be able to express the running time of algorithms using O notation.

Problem 3: Asymptotic notation 3. f(n) = 20/n g(n) = 1/lg(n) Is f(n) o, O, Q, W or w of g(n)? (list all that apply)

Problem 4: Asymptotic notation 4. f(n) = lg(n) for n even g(n) = 0.5n2 + 37 3n2 for n odd a) Graph f(n) b) Is f(n) o, O, Q, W or w of g(n)? (list all that apply)

Problem 5. Probability 5. Suppose you throw two 4-sided dice (e.g. tetrahedral dice) with values of 1, 2, 3, or 4 on each side. a) What is the Sample Space? b) If event A is all the throws in which the sum of values is less than or equal to 3, list all the outcomes in event A.

Problem 5 continued Suppose we define a discrete random variable, s, such that the value of s is the sum of the dice from a single throw. List the values of s for each outcome in the sample space. d) What is the expected value for the sum of the two dice?