A point p is said to be dominated by point q if p.x=q.x&p.y=q.y 2 true. In RAM computation model, RAM stands for Random Access Model.

Size: px
Start display at page:

Download "A point p is said to be dominated by point q if p.x=q.x&p.y=q.y 2 true. In RAM computation model, RAM stands for Random Access Model."

Transcription

1 In analysis the upper bound means the function grows asymptotically no faster than its largest term. 1 true A point p is said to be dominated by point q if p.x=q.x&p.y=q.y 2 true In RAM computation model, RAM stands for Random Access Model. 3 false A Function f(n) = n(logn+1)/2 is asymptotically equivalent to n log n. Here Upper Bound means the function f(n) grows asymptotically faster than n log n. 4 not The sequence of merge sort algorithm is: 5 Devide-Conquer-Combine The Omega-notation allows us to state only the asymptotic bounds. 6 Lower If input n is odd, then median will be 7 (n+1)/2 In plane sweep approach, a vertical line is swept across the 2d-plane from 8 Left to Right Sorting can be in 9 Both increasing and decreasing order Pseudo code of algorithms are to be read by 10 People

2 Question # 1 of 10 ( Start time: 09:46:15 PM ) Total Marks: 1 In Selection algorithm, we assume pivot selection takes theta running time. n ( answer) n2 n3 log(n) Question # 2 of 10 ( Start time: 09:47:10 PM ) Total Marks: 1 The function f(n)=n(logn+1)/2 is asymptotically equivalent to nlog n. Here Lower Bound means function f(n) grows asymptotically at as fast as nlog n. Normal Least Most ( answer) All Question # 3 of 10 ( Start time: 09:48:39 PM ) Total Marks: 1 While solving Selection problem, in Sieve technique we choose pivot Minimum element Maximum element Randomly ( answer) Average element Question # 4 of 10 ( Start time: 09:49:25 PM ) Total Marks: 1 Asymptotic growth rate of the function is taken over case running time. Best Average Worst ( answer) Normal Question # 5 of 10 ( Start time: 09:50:00 PM ) Total Marks: 1 For the worst-case running time analysis, the nested loop structure containing one for and one while loop, might be expressed as a pair of nested summations

3 4 ( answer) not cnfrm Question # 6 of 10 ( Start time: 09:51:26 PM ) Total Marks: 1 8n2 + 2n - 3 will eventually exceed c2*(n) no matter how large we make c2. ( answer) Question # 7 of 10 ( Start time: 09:52:37 PM ) Total Marks: 1 The ancient Roman politicians understood an important principle of good algorithm design that is plan-sweep algorithm. ( answer) In we have to find rank of an element from given input. Merge sort algorithm Slection problem ( answer) Brute force technique Plane Sweep algorithm Question # 9 of 10 ( Start time: 09:54:47 PM ) Total Marks: 1 In addition to passing in the array, the other arguments passed to Merge Sort algorithm are indices of the array that we are to sort. First Sub ( answer) Main & Sub Sub & Main Question # 10 of 10 ( Start time: 09:56:10 PM ) Total Marks: 1 In 2d-space a point is said to be if it is not dominated by any other point in that space. Member Minimal Maximal ( answer)

4 Question # 1 of 10 ( Start time: 10:09:04 PM ) Total Marks: 1 If input n is odd, the median will be (n+1)/ 2 (Answer) n/2 Question # 2 of 10 ( Start time: 10:09:04 PM ) Total Marks: 1 When writing pseudo code, those are omitted that detract from the main ideas of the algorithm. Essentials Details (Answer) Summaries Inputs Question # 3 of 10 ( Start time: 10:10:55 PM ) Total Marks: 1 Recurrence can be described in terms of a tree. Yes (Answer) No Question # 4 of 10 ( Start time: 10:11:52 PM ) Total Marks: 1 In RAM computation model, RAM stands for Random Access Model. (Answer) Question # 5 of 10 ( Start time: 10:12:24 PM ) Total Marks: 1 An algorithm is a mathematical entity that is dependent on a specific programming language. (Answer) Question # 6 of 10 ( Start time: 10:13:39 PM ) Total Marks: 1 Rank of an element can be defined as One minus the number of elements that are smaller Two plus the number of elements that are greater One plus no of elements that are smaller (Answer) Two minus the number of elements that are smaller

5 Question # 7 of 10 ( Start time: 10:14:37 PM ) Total Marks: 1 After sorting in merge sort algorithm, merging process is invoked. (Answer) Question # 8 of 10 ( Start time: 10:15:09 PM ) Total Marks: 1 Algorithm is a mathematical entity, which is independent of a specific machine and operating system. (Answer) Question # 9 of 10 ( Start time: 10:15:39 PM ) Total Marks: 1 Sieve technique is very important special case of Divide-and-Conquer strategy. (Answer) Question # 10 of 10 ( Start time: 10:16:09 PM ) Total Marks: 1 For small values of n, any algorithm is fast enough. Running time does become an isuue when n gets large. (Answer) Fast Question # 1 of 10 ( Start time: 10:37:05 PM ) Total Marks: 1 Pseudo code of algorithms are to be read by. People ok RAM Computer Compiler

6 Question # 2 of 10 ( Start time: 10:37:35 PM ) Total Marks: 1 If we associate (x, y) integers pair to cars where x is the speed of the car and y is the nega tion of the price. High y value for a car means a car. Fast Slow Expensive Cheap ok Question # 3 of 10 ( Start time: 10:38:54 PM ) Total Marks: 1 After sorting in merge sort algorithm, merging process is invoked. ok Question # 4 of 10 ( Start time: 10:39:19 PM ) Total Marks: 1 In the statement output P[i].x, P[i].y, the number of times elements of P are accessed is 1 2 ok 3 4 Question # 5 of 10 ( Start time: 10:39:42 PM ) Total Marks: 1 In selection problem, the rank of an element will be its position if we sort the input data. first final ok Second last Last Question # 6 of 10 ( Start time: 10:40:03 PM ) Total Marks: 1...of reference is an important fact of current processor technology. Defining Assigning Formality Locality ok

7 Question # 7 of 10 ( Start time: 10:40:39 PM ) Total Marks: 1 In Selection problem, the Sieve technique works in Non-recursive manner Constant time Phases ok One complete go Question # 8 of 10 ( Start time: 10:41:07 PM ) Total Marks: 1 Brute-force algorithm for 2D- Maxima is operated by comparing pairs of points. Two Some Most All ok Question # 9 of 10 ( Start time: 10:42:21 PM ) Total Marks: 1 Floor and ceiling are to calculate while analyzing algorithms. Very easy Usually considered difficult ok Question # 10 of 10 ( Start time: 10:42:58 PM ) Total Marks: 1 The function f(n)= n(logn+1)/2 is asymptotically equivalent to n log n. Hre Upper Bound means the function f(n) grows asymptotically faster than n log n. More Quiet Not ok At least CS502 Fundamentals of Algorithms Quiz No. 1, File 6 Question # 1 of 10 ( Start time: 10:51:54 PM ) Total Marks: 1 Median is not useful measure of central tendency of given input set especially when the d istribution of values is highly skewed.

8 Question # 2 of 10 ( Start time: 10:52:29 PM ) Total Marks: 1 Al-Khwarizmi was a/an... Artist Mathematician ok Astronomer Khalifah Question # 3 of 10 ( Start time: 10:52:56 PM ) Total Marks: 1 In merge sort algorithm, we split the array around the index q. Entring Mid ok Exiting Summing Question # 4 of 10 ( Start time: 10:54:06 PM ) Total Marks: 1 is one of the few problems, where provable lower bounds exist on how fast w e can sort. Searching Sorting ok Both Searching & Sorting Graphing Question # 5 of 10 ( Start time: 10:55:29 PM ) Total Marks: 1 In asymptotical analysis of n*(5 + 2) 3, as n becomes large, the dominant (fastest growing) term is some constant times n_1 n n+1 n*n Question # 6 of 10 ( Start time: 10:56:41 PM ) Total Marks: 1 The total running time for Selection algorithm is Quadratic

9 Linear ok Geometric Exponential Question # 7 of 10 ( Start time: 10:57:12 PM ) Total Marks: 1 When writing pseudo code, those are omitted that detract from the main ideas of the algorithm. Essentials Details ok Summaries Inputs Question # 8 of 10 ( Start time: 10:57:35 PM ) Total Marks: 1 The ancient Roman politicians understood an important principle of good algorithm desig n that is plan-sweep algorithm. ok Question # 9 of 10 ( Start time: 10:57:58 PM ) Total Marks: 1 In analysis, the Lower Bound means the function grows asymptotically at least as fast as i ts largest term. ok In asymptotical analysis of n(n - 3) and 4n*n, as n becomes large, the dominant (fastest growing) term is some constant ti mes. n+1 n-1 n ok n*n CS502 Fundamentals of Algorithms Quiz No. 1, File 7

10 Question # 1 of 10 ( Start time: 11:04:26 PM ) Total Marks: 1 In merge sort algorithm, we split the array around the index q. Entring Mid ok Exiting Summing Question # 2 of 10 ( Start time: 11:04:41 PM ) Total Marks: 1 provides us more accurate result when input values are not closer with each other. Average Median ok Question # 3 of 10 ( Start time: 11:05:30 PM ) Total Marks: 1 Recurrence can be described in terms of a tree. Yes ok No Question # 4 of 10 ( Start time: 11:05:51 PM ) Total Marks: 1 The time assumed for each basic operation to execute on RAM model of computation is Infinite ok Continuous Constant Variable Question # 5 of 10 ( Start time: 11:06:17 PM ) Total Marks: 1 If pj dominates pi and pi dominates ph then pj also dominates ph. It means dominance rel ation is Transitive ok Non Transitive Equation Symbolic Question # 6 of 10 ( Start time: 11:06:46 PM ) Total Marks: 1 Selection algorithm takes theta

11 (n2) (n) ok log(n) nlog(n) Question # 7 of 10 ( Start time: 11:07:28 PM ) Total Marks: 1 Algorithm analysts know for sure about efficient solutions for NP-complete problems. ok Question # 8 of 10 ( Start time: 11:08:12 PM ) Total Marks: 1 Brute-force algorithm uses no intelligence in pruning out decisions. ok Question # 9 of 10 ( Start time: 11:08:52 PM ) Total Marks: 1 In RAM computation model, RAM stands for Random Access Model. ok Question # 10 of 10 ( Start time: 11:09:10 PM ) Total Marks: 1 For solving Selection problem, we introduced Sieve technique due to Using Decrease and Conquer strategy Avoiding to sort all input data Eliminating Rank of an element Using Brute-force approach CS502 Fundamentals of Algorithms Quiz No. 1, File 8 Question # 1 of 10 ( Start time: 11:25:00 PM ) Total Marks: 1 Before sweeping a vertical line in plane sweep approach, in start sorting of the points is d one in increasing order of their coordinates.

12 X Y Z X & Y Question # 3 of 10 ( Start time: 11:26:39 PM ) Total Marks: 1 The number of accesses to any element of space is not counted for the running time calcu lation of algorithm. Question # 4 of 10 ( Start time: 11:28:01 PM ) Total Marks: 1 Quick sort is best from the perspective of Locality of reference. ok Question # 5 of 10 ( Start time: 11:28:34 PM ) Total Marks: 1 In the statement "if (P[i].x < P[j].x) & (P[i].y < P[j].y)", the number of times elements of P are accessed is ok Question # 6 of 10 ( Start time: 11:28:56 PM ) Total Marks: 1 provides us more accurate result when input values are not closer with each other. Average Median ok Question # 7 of 10 ( Start time: 11:29:28 PM ) Total Marks: 1 The brute-force algorithm for 2D-Maxima runs in order O( ) time. n n(log n) n*n ok n3

13 Question # 8 of 10 ( Start time: 11:30:58 PM ) Total Marks: 1 Rank of an element can be defined as One minus the number of elements that are smaller Two plus the number of elements that are greater One plus the number of elements that are smaller ok Two minus the number of elements that are smaller Question # 9 of 10 ( Start time: 11:31:29 PM ) Total Marks: 1 In pseudo code, the level of details depends on intended audience of the algorithm. ok Question # 10 of 10 ( Start time: 11:32:03 PM ) Total Marks: 1 In Sieve technique, we solve the problem In recursive manner Non recursively Using Merge Sort algorithm Using Brute force technique CS502 Fundamentals of Algorithms Quiz No. 1, File 9 Question # 3 of 10 ( Start time: 11:25:20 PM ) Total Marks: 1 When writing pseudo code, those are omitted that detract from the main ideas of the algorithm. Essentials Details Summaries Inputs Question # 4 of 10 ( Start time: 11:26:29 PM ) Total Marks: 1 f(n) is a set of functions such that there exist positive constants c1, c2 and n0 such that 0 <= c1g(n) <= f(n) <= c2g(n) for all n _ n0 Then f(n) is asymptotically g(

14 n). Less than Greater than Equivalent to Not equivalent to Question # 5 of 10 ( Start time: 11:27:11 PM ) Total Marks: 1 If the indices passed to merge sort algorithm are,then this means that there is o nly one element to sort. Small Large Equal Not Equal Question # 6 of 10 ( Start time: 11:27:46 PM ) Total Marks: 1 Algorithm is a sequence of computational steps that...the input into output. Merge Assign Transform Integrate Question # 7 of 10 ( Start time: 11:28:27 PM ) Total Marks: 1 Merge sort is based on. Brute-force Plan-sweep Axis-sweep Divide and Conquer Question # 8 of 10 ( Start time: 11:29:00 PM ) Total Marks: 1 The sequence of merge sort algorithm is: Divide-Combine-Conquer Conquer-Divide-Combine Divide-Conquer-Combine Combine-Divide-Conquer Question # 9 of 10 ( Start time: 11:29:30 PM ) Total Marks: 1

15 In we have to find rank of an element from given input. Merge sort algorithm Selection problem Brute force technique Plane Sweep algorithm Question # 10 of 10 ( Start time: 11:30:18 PM ) Total Marks: 1 In the statement "if (P[i].x < P[j].x) & (P[i].y < P[j].y)", the number of times elements of P are accessed is

Design and Analysis of Algorithms

Design and Analysis of Algorithms Design and Analysis of Algorithms Sohail Aslam January 2004 2 Contents 1 Introduction 7 1.1 Origin of word: Algorithm.................................. 7 1.2 Algorithm: Informal Definition................................

More information

Algorithms, Design and Analysis. Order of growth. Table 2.1. Big-oh. Asymptotic growth rate. Types of formulas for basic operation count

Algorithms, Design and Analysis. Order of growth. Table 2.1. Big-oh. Asymptotic growth rate. Types of formulas for basic operation count Types of formulas for basic operation count Exact formula e.g., C(n) = n(n-1)/2 Algorithms, Design and Analysis Big-Oh analysis, Brute Force, Divide and conquer intro Formula indicating order of growth

More information

CS 4407 Algorithms Lecture 2: Iterative and Divide and Conquer Algorithms

CS 4407 Algorithms Lecture 2: Iterative and Divide and Conquer Algorithms CS 4407 Algorithms Lecture 2: Iterative and Divide and Conquer Algorithms Prof. Gregory Provan Department of Computer Science University College Cork 1 Lecture Outline CS 4407, Algorithms Growth Functions

More information

CS 4407 Algorithms Lecture 3: Iterative and Divide and Conquer Algorithms

CS 4407 Algorithms Lecture 3: Iterative and Divide and Conquer Algorithms CS 4407 Algorithms Lecture 3: Iterative and Divide and Conquer Algorithms Prof. Gregory Provan Department of Computer Science University College Cork 1 Lecture Outline CS 4407, Algorithms Growth Functions

More information

Principles of Algorithm Analysis

Principles of Algorithm Analysis C H A P T E R 3 Principles of Algorithm Analysis 3.1 Computer Programs The design of computer programs requires:- 1. An algorithm that is easy to understand, code and debug. This is the concern of software

More information

Topic 17. Analysis of Algorithms

Topic 17. Analysis of Algorithms Topic 17 Analysis of Algorithms Analysis of Algorithms- Review Efficiency of an algorithm can be measured in terms of : Time complexity: a measure of the amount of time required to execute an algorithm

More information

The Time Complexity of an Algorithm

The Time Complexity of an Algorithm Analysis of Algorithms The Time Complexity of an Algorithm Specifies how the running time depends on the size of the input. Purpose To estimate how long a program will run. To estimate the largest input

More information

Analysis of Algorithm Efficiency. Dr. Yingwu Zhu

Analysis of Algorithm Efficiency. Dr. Yingwu Zhu Analysis of Algorithm Efficiency Dr. Yingwu Zhu Measure Algorithm Efficiency Time efficiency How fast the algorithm runs; amount of time required to accomplish the task Our focus! Space efficiency Amount

More information

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2019

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2019 CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis Ruth Anderson Winter 2019 Today Algorithm Analysis What do we care about? How to compare two algorithms Analyzing Code Asymptotic Analysis

More information

CSED233: Data Structures (2017F) Lecture4: Analysis of Algorithms

CSED233: Data Structures (2017F) Lecture4: Analysis of Algorithms (2017F) Lecture4: Analysis of Algorithms Daijin Kim CSE, POSTECH dkim@postech.ac.kr Running Time Most algorithms transform input objects into output objects. The running time of an algorithm typically

More information

Divide and Conquer Algorithms

Divide and Conquer Algorithms Divide and Conquer Algorithms T. M. Murali March 17, 2014 Divide and Conquer Break up a problem into several parts. Solve each part recursively. Solve base cases by brute force. Efficiently combine solutions

More information

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2018

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2018 CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis Ruth Anderson Winter 2018 Today Algorithm Analysis What do we care about? How to compare two algorithms Analyzing Code Asymptotic Analysis

More information

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2018

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2018 CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis Ruth Anderson Winter 2018 Today Algorithm Analysis What do we care about? How to compare two algorithms Analyzing Code Asymptotic Analysis

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms Spring 2017-2018 Outline 1 Sorting Algorithms (contd.) Outline Sorting Algorithms (contd.) 1 Sorting Algorithms (contd.) Analysis of Quicksort Time to sort array of length

More information

Module 1: Analyzing the Efficiency of Algorithms

Module 1: Analyzing the Efficiency of Algorithms Module 1: Analyzing the Efficiency of Algorithms Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu What is an Algorithm?

More information

The Time Complexity of an Algorithm

The Time Complexity of an Algorithm CSE 3101Z Design and Analysis of Algorithms The Time Complexity of an Algorithm Specifies how the running time depends on the size of the input. Purpose To estimate how long a program will run. To estimate

More information

Computational Complexity

Computational Complexity Computational Complexity S. V. N. Vishwanathan, Pinar Yanardag January 8, 016 1 Computational Complexity: What, Why, and How? Intuitively an algorithm is a well defined computational procedure that takes

More information

Divide and Conquer Algorithms

Divide and Conquer Algorithms Divide and Conquer Algorithms T. M. Murali February 19, 2013 Divide and Conquer Break up a problem into several parts. Solve each part recursively. Solve base cases by brute force. Efficiently combine

More information

Advanced Algorithmics (6EAP)

Advanced Algorithmics (6EAP) Advanced Algorithmics (6EAP) MTAT.03.238 Order of growth maths Jaak Vilo 2017 fall Jaak Vilo 1 Program execution on input of size n How many steps/cycles a processor would need to do How to relate algorithm

More information

Ch 01. Analysis of Algorithms

Ch 01. Analysis of Algorithms Ch 01. Analysis of Algorithms Input Algorithm Output Acknowledgement: Parts of slides in this presentation come from the materials accompanying the textbook Algorithm Design and Applications, by M. T.

More information

Omega notation. Transitivity etc.

Omega notation. Transitivity etc. Omega notation Big-Omega: Lecture 2, Sept. 25, 2014 f () n (()) g n const cn, s.t. n n : cg() n f () n Small-omega: 0 0 0 f () n (()) g n const c, n s.t. n n : cg() n f () n 0 0 0 Intuition (works most

More information

CS173 Running Time and Big-O. Tandy Warnow

CS173 Running Time and Big-O. Tandy Warnow CS173 Running Time and Big-O Tandy Warnow CS 173 Running Times and Big-O analysis Tandy Warnow Today s material We will cover: Running time analysis Review of running time analysis of Bubblesort Review

More information

Great Theoretical Ideas in Computer Science. Lecture 7: Introduction to Computational Complexity

Great Theoretical Ideas in Computer Science. Lecture 7: Introduction to Computational Complexity 15-251 Great Theoretical Ideas in Computer Science Lecture 7: Introduction to Computational Complexity September 20th, 2016 What have we done so far? What will we do next? What have we done so far? > Introduction

More information

Module 1: Analyzing the Efficiency of Algorithms

Module 1: Analyzing the Efficiency of Algorithms Module 1: Analyzing the Efficiency of Algorithms Dr. Natarajan Meghanathan Associate Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu Based

More information

Divide-and-conquer: Order Statistics. Curs: Fall 2017

Divide-and-conquer: Order Statistics. Curs: Fall 2017 Divide-and-conquer: Order Statistics Curs: Fall 2017 The divide-and-conquer strategy. 1. Break the problem into smaller subproblems, 2. recursively solve each problem, 3. appropriately combine their answers.

More information

Asymptotic Notation. such that t(n) cf(n) for all n n 0. for some positive real constant c and integer threshold n 0

Asymptotic Notation. such that t(n) cf(n) for all n n 0. for some positive real constant c and integer threshold n 0 Asymptotic Notation Asymptotic notation deals with the behaviour of a function in the limit, that is, for sufficiently large values of its parameter. Often, when analysing the run time of an algorithm,

More information

Ch01. Analysis of Algorithms

Ch01. Analysis of Algorithms Ch01. Analysis of Algorithms Input Algorithm Output Acknowledgement: Parts of slides in this presentation come from the materials accompanying the textbook Algorithm Design and Applications, by M. T. Goodrich

More information

COMP 9024, Class notes, 11s2, Class 1

COMP 9024, Class notes, 11s2, Class 1 COMP 90, Class notes, 11s, Class 1 John Plaice Sun Jul 31 1::5 EST 011 In this course, you will need to know a bit of mathematics. We cover in today s lecture the basics. Some of this material is covered

More information

CPS 616 DIVIDE-AND-CONQUER 6-1

CPS 616 DIVIDE-AND-CONQUER 6-1 CPS 616 DIVIDE-AND-CONQUER 6-1 DIVIDE-AND-CONQUER Approach 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances recursively 3. Obtain solution to original (larger)

More information

Lecture 2. Fundamentals of the Analysis of Algorithm Efficiency

Lecture 2. Fundamentals of the Analysis of Algorithm Efficiency Lecture 2 Fundamentals of the Analysis of Algorithm Efficiency 1 Lecture Contents 1. Analysis Framework 2. Asymptotic Notations and Basic Efficiency Classes 3. Mathematical Analysis of Nonrecursive Algorithms

More information

Analysis of Algorithms

Analysis of Algorithms September 29, 2017 Analysis of Algorithms CS 141, Fall 2017 1 Analysis of Algorithms: Issues Correctness/Optimality Running time ( time complexity ) Memory requirements ( space complexity ) Power I/O utilization

More information

Big O 2/14/13. Administrative. Does it terminate? David Kauchak cs302 Spring 2013

Big O 2/14/13. Administrative. Does it terminate? David Kauchak cs302 Spring 2013 /4/3 Administrative Big O David Kauchak cs3 Spring 3 l Assignment : how d it go? l Assignment : out soon l CLRS code? l Videos Insertion-sort Insertion-sort Does it terminate? /4/3 Insertion-sort Loop

More information

P, NP, NP-Complete, and NPhard

P, NP, NP-Complete, and NPhard P, NP, NP-Complete, and NPhard Problems Zhenjiang Li 21/09/2011 Outline Algorithm time complicity P and NP problems NP-Complete and NP-Hard problems Algorithm time complicity Outline What is this course

More information

data structures and algorithms lecture 2

data structures and algorithms lecture 2 data structures and algorithms 2018 09 06 lecture 2 recall: insertion sort Algorithm insertionsort(a, n): for j := 2 to n do key := A[j] i := j 1 while i 1 and A[i] > key do A[i + 1] := A[i] i := i 1 A[i

More information

Growth of Functions. As an example for an estimate of computation time, let us consider the sequential search algorithm.

Growth of Functions. As an example for an estimate of computation time, let us consider the sequential search algorithm. Function Growth of Functions Subjects to be Learned Contents big oh max function big omega big theta little oh little omega Introduction One of the important criteria in evaluating algorithms is the time

More information

CS483 Design and Analysis of Algorithms

CS483 Design and Analysis of Algorithms CS483 Design and Analysis of Algorithms Chapter 2 Divide and Conquer Algorithms Instructor: Fei Li lifei@cs.gmu.edu with subject: CS483 Office hours: Room 5326, Engineering Building, Thursday 4:30pm -

More information

Mergesort and Recurrences (CLRS 2.3, 4.4)

Mergesort and Recurrences (CLRS 2.3, 4.4) Mergesort and Recurrences (CLRS 2.3, 4.4) We saw a couple of O(n 2 ) algorithms for sorting. Today we ll see a different approach that runs in O(n lg n) and uses one of the most powerful techniques for

More information

CS481: Bioinformatics Algorithms

CS481: Bioinformatics Algorithms CS481: Bioinformatics Algorithms Can Alkan EA224 calkan@cs.bilkent.edu.tr http://www.cs.bilkent.edu.tr/~calkan/teaching/cs481/ Reminder The TA will hold a few recitation sessions for the students from

More information

CS Analysis of Recursive Algorithms and Brute Force

CS Analysis of Recursive Algorithms and Brute Force CS483-05 Analysis of Recursive Algorithms and Brute Force Instructor: Fei Li Room 443 ST II Office hours: Tue. & Thur. 4:30pm - 5:30pm or by appointments lifei@cs.gmu.edu with subject: CS483 http://www.cs.gmu.edu/

More information

CS 231: Algorithmic Problem Solving

CS 231: Algorithmic Problem Solving CS 231: Algorithmic Problem Solving Naomi Nishimura Module 4 Date of this version: June 11, 2018 WARNING: Drafts of slides are made available prior to lecture for your convenience. After lecture, slides

More information

Lecture 1: Asymptotics, Recurrences, Elementary Sorting

Lecture 1: Asymptotics, Recurrences, Elementary Sorting Lecture 1: Asymptotics, Recurrences, Elementary Sorting Instructor: Outline 1 Introduction to Asymptotic Analysis Rate of growth of functions Comparing and bounding functions: O, Θ, Ω Specifying running

More information

Data Structures and Algorithms. Asymptotic notation

Data Structures and Algorithms. Asymptotic notation Data Structures and Algorithms Asymptotic notation Estimating Running Time Algorithm arraymax executes 7n 1 primitive operations in the worst case. Define: a = Time taken by the fastest primitive operation

More information

Introduction. An Introduction to Algorithms and Data Structures

Introduction. An Introduction to Algorithms and Data Structures Introduction An Introduction to Algorithms and Data Structures Overview Aims This course is an introduction to the design, analysis and wide variety of algorithms (a topic often called Algorithmics ).

More information

Algorithms and Their Complexity

Algorithms and Their Complexity CSCE 222 Discrete Structures for Computing David Kebo Houngninou Algorithms and Their Complexity Chapter 3 Algorithm An algorithm is a finite sequence of steps that solves a problem. Computational complexity

More information

Algorithm Analysis, Asymptotic notations CISC4080 CIS, Fordham Univ. Instructor: X. Zhang

Algorithm Analysis, Asymptotic notations CISC4080 CIS, Fordham Univ. Instructor: X. Zhang Algorithm Analysis, Asymptotic notations CISC4080 CIS, Fordham Univ. Instructor: X. Zhang Last class Introduction to algorithm analysis: fibonacci seq calculation counting number of computer steps recursive

More information

IS 709/809: Computational Methods in IS Research Fall Exam Review

IS 709/809: Computational Methods in IS Research Fall Exam Review IS 709/809: Computational Methods in IS Research Fall 2017 Exam Review Nirmalya Roy Department of Information Systems University of Maryland Baltimore County www.umbc.edu Exam When: Tuesday (11/28) 7:10pm

More information

Analysis of Algorithms

Analysis of Algorithms Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Analysis of Algorithms Input Algorithm Analysis

More information

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Catie Baker Spring 2015

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Catie Baker Spring 2015 CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Catie Baker Spring 2015 Today Registration should be done. Homework 1 due 11:59pm next Wednesday, April 8 th. Review math

More information

Asymptotic Running Time of Algorithms

Asymptotic Running Time of Algorithms Asymptotic Complexity: leading term analysis Asymptotic Running Time of Algorithms Comparing searching and sorting algorithms so far: Count worst-case of comparisons as function of array size. Drop lower-order

More information

MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 2

MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 2 MA008 p.1/36 MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 2 Dr. Markus Hagenbuchner markus@uow.edu.au. MA008 p.2/36 Content of lecture 2 Examples Review data structures Data types vs. data

More information

Analysis of Algorithms I: Asymptotic Notation, Induction, and MergeSort

Analysis of Algorithms I: Asymptotic Notation, Induction, and MergeSort Analysis of Algorithms I: Asymptotic Notation, Induction, and MergeSort Xi Chen Columbia University We continue with two more asymptotic notation: o( ) and ω( ). Let f (n) and g(n) are functions that map

More information

Algorithms Design & Analysis. Analysis of Algorithm

Algorithms Design & Analysis. Analysis of Algorithm Algorithms Design & Analysis Analysis of Algorithm Review Internship Stable Matching Algorithm 2 Outline Time complexity Computation model Asymptotic notions Recurrence Master theorem 3 The problem of

More information

Input Decidable Language -- Program Halts on all Input Encoding of Input -- Natural Numbers Encoded in Binary or Decimal, Not Unary

Input Decidable Language -- Program Halts on all Input Encoding of Input -- Natural Numbers Encoded in Binary or Decimal, Not Unary Complexity Analysis Complexity Theory Input Decidable Language -- Program Halts on all Input Encoding of Input -- Natural Numbers Encoded in Binary or Decimal, Not Unary Output TRUE or FALSE Time and Space

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 9 Divide and Conquer Merge sort Counting Inversions Binary Search Exponentiation Solving Recurrences Recursion Tree Method Master Theorem Sofya Raskhodnikova S. Raskhodnikova;

More information

LECTURE NOTES ON DESIGN AND ANALYSIS OF ALGORITHMS

LECTURE NOTES ON DESIGN AND ANALYSIS OF ALGORITHMS G.PULLAIAH COLLEGE OF ENGINEERING AND TECHNOLOGY LECTURE NOTES ON DESIGN AND ANALYSIS OF ALGORITHMS Department of Computer Science and Engineering 1 UNIT 1 Basic Concepts Algorithm An Algorithm is a finite

More information

Review Of Topics. Review: Induction

Review Of Topics. Review: Induction Review Of Topics Asymptotic notation Solving recurrences Sorting algorithms Insertion sort Merge sort Heap sort Quick sort Counting sort Radix sort Medians/order statistics Randomized algorithm Worst-case

More information

Asymptotic Analysis of Algorithms. Chapter 4

Asymptotic Analysis of Algorithms. Chapter 4 Asymptotic Analysis of Algorithms Chapter 4 Overview Motivation Definition of Running Time Classifying Running Time Asymptotic Notation & Proving Bounds Algorithm Complexity vs Problem Complexity Overview

More information

Divide & Conquer. CS 320, Fall Dr. Geri Georg, Instructor CS320 Div&Conq 1

Divide & Conquer. CS 320, Fall Dr. Geri Georg, Instructor CS320 Div&Conq 1 Divide & Conquer CS 320, Fall 2017 Dr. Geri Georg, Instructor georg@colostate.edu CS320 Div&Conq 1 Strategy 1. Divide the problem up into equal sized sub problems 2. Solve the sub problems recursively

More information

CS 4407 Algorithms Lecture 2: Growth Functions

CS 4407 Algorithms Lecture 2: Growth Functions CS 4407 Algorithms Lecture 2: Growth Functions Prof. Gregory Provan Department of Computer Science University College Cork 1 Lecture Outline Growth Functions Mathematical specification of growth functions

More information

Sorting. Chapter 11. CSE 2011 Prof. J. Elder Last Updated: :11 AM

Sorting. Chapter 11. CSE 2011 Prof. J. Elder Last Updated: :11 AM Sorting Chapter 11-1 - Sorting Ø We have seen the advantage of sorted data representations for a number of applications q Sparse vectors q Maps q Dictionaries Ø Here we consider the problem of how to efficiently

More information

Lecture 1 - Preliminaries

Lecture 1 - Preliminaries Advanced Algorithms Floriano Zini Free University of Bozen-Bolzano Faculty of Computer Science Academic Year 2013-2014 Lecture 1 - Preliminaries 1 Typography vs algorithms Johann Gutenberg (c. 1398 February

More information

COMP 355 Advanced Algorithms

COMP 355 Advanced Algorithms COMP 355 Advanced Algorithms Algorithm Design Review: Mathematical Background 1 Polynomial Running Time Brute force. For many non-trivial problems, there is a natural brute force search algorithm that

More information

Copyright 2000, Kevin Wayne 1

Copyright 2000, Kevin Wayne 1 Algorithm runtime analysis and computational tractability Time Complexity of an Algorithm How do we measure the complexity (time, space requirements) of an algorithm. 1 microsecond? Units of time As soon

More information

V. Adamchik 1. Recurrences. Victor Adamchik Fall of 2005

V. Adamchik 1. Recurrences. Victor Adamchik Fall of 2005 V. Adamchi Recurrences Victor Adamchi Fall of 00 Plan Multiple roots. More on multiple roots. Inhomogeneous equations 3. Divide-and-conquer recurrences In the previous lecture we have showed that if the

More information

Computer Algorithms CISC4080 CIS, Fordham Univ. Outline. Last class. Instructor: X. Zhang Lecture 2

Computer Algorithms CISC4080 CIS, Fordham Univ. Outline. Last class. Instructor: X. Zhang Lecture 2 Computer Algorithms CISC4080 CIS, Fordham Univ. Instructor: X. Zhang Lecture 2 Outline Introduction to algorithm analysis: fibonacci seq calculation counting number of computer steps recursive formula

More information

Computer Algorithms CISC4080 CIS, Fordham Univ. Instructor: X. Zhang Lecture 2

Computer Algorithms CISC4080 CIS, Fordham Univ. Instructor: X. Zhang Lecture 2 Computer Algorithms CISC4080 CIS, Fordham Univ. Instructor: X. Zhang Lecture 2 Outline Introduction to algorithm analysis: fibonacci seq calculation counting number of computer steps recursive formula

More information

An analogy from Calculus: limits

An analogy from Calculus: limits COMP 250 Fall 2018 35 - big O Nov. 30, 2018 We have seen several algorithms in the course, and we have loosely characterized their runtimes in terms of the size n of the input. We say that the algorithm

More information

Growth of Functions (CLRS 2.3,3)

Growth of Functions (CLRS 2.3,3) Growth of Functions (CLRS 2.3,3) 1 Review Last time we discussed running time of algorithms and introduced the RAM model of computation. Best-case running time: the shortest running time for any input

More information

CS 344 Design and Analysis of Algorithms. Tarek El-Gaaly Course website:

CS 344 Design and Analysis of Algorithms. Tarek El-Gaaly Course website: CS 344 Design and Analysis of Algorithms Tarek El-Gaaly tgaaly@cs.rutgers.edu Course website: www.cs.rutgers.edu/~tgaaly/cs344.html Course Outline Textbook: Algorithms by S. Dasgupta, C.H. Papadimitriou,

More information

Recursion. Computational complexity

Recursion. Computational complexity List. Babes-Bolyai University arthur@cs.ubbcluj.ro Overview List 1 2 List Second Laboratory Test List Will take place week 12, during the laboratory You will receive one problem statement, from what was

More information

COMP 355 Advanced Algorithms Algorithm Design Review: Mathematical Background

COMP 355 Advanced Algorithms Algorithm Design Review: Mathematical Background COMP 355 Advanced Algorithms Algorithm Design Review: Mathematical Background 1 Polynomial Time Brute force. For many non-trivial problems, there is a natural brute force search algorithm that checks every

More information

Week 5: Quicksort, Lower bound, Greedy

Week 5: Quicksort, Lower bound, Greedy Week 5: Quicksort, Lower bound, Greedy Agenda: Quicksort: Average case Lower bound for sorting Greedy method 1 Week 5: Quicksort Recall Quicksort: The ideas: Pick one key Compare to others: partition into

More information

Algorithm. Executing the Max algorithm. Algorithm and Growth of Functions Benchaporn Jantarakongkul. (algorithm) ก ก. : ก {a i }=a 1,,a n a i N,

Algorithm. Executing the Max algorithm. Algorithm and Growth of Functions Benchaporn Jantarakongkul. (algorithm) ก ก. : ก {a i }=a 1,,a n a i N, Algorithm and Growth of Functions Benchaporn Jantarakongkul 1 Algorithm (algorithm) ก ก ก ก ก : ก {a i }=a 1,,a n a i N, ก ก : 1. ก v ( v ก ก ก ก ) ก ก a 1 2. ก a i 3. a i >v, ก v ก a i 4. 2. 3. ก ก ก

More information

Linear Selection and Linear Sorting

Linear Selection and Linear Sorting Analysis of Algorithms Linear Selection and Linear Sorting If more than one question appears correct, choose the more specific answer, unless otherwise instructed. Concept: linear selection 1. Suppose

More information

Analysis of Algorithms [Reading: CLRS 2.2, 3] Laura Toma, csci2200, Bowdoin College

Analysis of Algorithms [Reading: CLRS 2.2, 3] Laura Toma, csci2200, Bowdoin College Analysis of Algorithms [Reading: CLRS 2.2, 3] Laura Toma, csci2200, Bowdoin College Why analysis? We want to predict how the algorithm will behave (e.g. running time) on arbitrary inputs, and how it will

More information

Fast Sorting and Selection. A Lower Bound for Worst Case

Fast Sorting and Selection. A Lower Bound for Worst Case Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 0 Fast Sorting and Selection USGS NEIC. Public domain government image. A Lower Bound

More information

Algorithm efficiency can be measured in terms of: Time Space Other resources such as processors, network packets, etc.

Algorithm efficiency can be measured in terms of: Time Space Other resources such as processors, network packets, etc. Algorithms Analysis Algorithm efficiency can be measured in terms of: Time Space Other resources such as processors, network packets, etc. Algorithms analysis tends to focus on time: Techniques for measuring

More information

Analysis of Algorithms CMPSC 565

Analysis of Algorithms CMPSC 565 Analysis of Algorithms CMPSC 565 LECTURES 38-39 Randomized Algorithms II Quickselect Quicksort Running time Adam Smith L1.1 Types of randomized analysis Average-case analysis : Assume data is distributed

More information

Introduction. How can we say that one algorithm performs better than another? Quantify the resources required to execute:

Introduction. How can we say that one algorithm performs better than another? Quantify the resources required to execute: Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Spring 2006 1 / 1 Computer Science & Engineering 235 Section 2.3 of Rosen cse235@cse.unl.edu Introduction How can we say that one algorithm

More information

1 Quick Sort LECTURE 7. OHSU/OGI (Winter 2009) ANALYSIS AND DESIGN OF ALGORITHMS

1 Quick Sort LECTURE 7. OHSU/OGI (Winter 2009) ANALYSIS AND DESIGN OF ALGORITHMS OHSU/OGI (Winter 2009) CS532 ANALYSIS AND DESIGN OF ALGORITHMS LECTURE 7 1 Quick Sort QuickSort 1 is a classic example of divide and conquer. The hard work is to rearrange the elements of the array A[1..n]

More information

Divide and Conquer Algorithms. CSE 101: Design and Analysis of Algorithms Lecture 14

Divide and Conquer Algorithms. CSE 101: Design and Analysis of Algorithms Lecture 14 Divide and Conquer Algorithms CSE 101: Design and Analysis of Algorithms Lecture 14 CSE 101: Design and analysis of algorithms Divide and conquer algorithms Reading: Sections 2.3 and 2.4 Homework 6 will

More information

Great Theoretical Ideas in Computer Science. Lecture 9: Introduction to Computational Complexity

Great Theoretical Ideas in Computer Science. Lecture 9: Introduction to Computational Complexity 15-251 Great Theoretical Ideas in Computer Science Lecture 9: Introduction to Computational Complexity February 14th, 2017 Poll What is the running time of this algorithm? Choose the tightest bound. def

More information

Analysis of Algorithms - Using Asymptotic Bounds -

Analysis of Algorithms - Using Asymptotic Bounds - Analysis of Algorithms - Using Asymptotic Bounds - Andreas Ermedahl MRTC (Mälardalens Real-Time Research Center) andreas.ermedahl@mdh.se Autumn 004 Rehersal: Asymptotic bounds Gives running time bounds

More information

Algorithms And Programming I. Lecture 5 Quicksort

Algorithms And Programming I. Lecture 5 Quicksort Algorithms And Programming I Lecture 5 Quicksort Quick Sort Partition set into two using randomly chosen pivot 88 31 25 52 14 98 62 30 23 79 14 31 2530 23 52 88 62 98 79 Quick Sort 14 31 2530 23 52 88

More information

CMPT 307 : Divide-and-Conqer (Study Guide) Should be read in conjunction with the text June 2, 2015

CMPT 307 : Divide-and-Conqer (Study Guide) Should be read in conjunction with the text June 2, 2015 CMPT 307 : Divide-and-Conqer (Study Guide) Should be read in conjunction with the text June 2, 2015 1 Introduction The divide-and-conquer strategy is a general paradigm for algorithm design. This strategy

More information

3. Algorithms. What matters? How fast do we solve the problem? How much computer resource do we need?

3. Algorithms. What matters? How fast do we solve the problem? How much computer resource do we need? 3. Algorithms We will study algorithms to solve many different types of problems such as finding the largest of a sequence of numbers sorting a sequence of numbers finding the shortest path between two

More information

Analysis of Algorithms

Analysis of Algorithms October 1, 2015 Analysis of Algorithms CS 141, Fall 2015 1 Analysis of Algorithms: Issues Correctness/Optimality Running time ( time complexity ) Memory requirements ( space complexity ) Power I/O utilization

More information

CSE 373: Data Structures and Algorithms Pep Talk; Algorithm Analysis. Riley Porter Winter 2017

CSE 373: Data Structures and Algorithms Pep Talk; Algorithm Analysis. Riley Porter Winter 2017 CSE 373: Data Structures and Algorithms Pep Talk; Algorithm Analysis Riley Porter Announcements Op4onal Java Review Sec4on: PAA A102 Tuesday, January 10 th, 3:30-4:30pm. Any materials covered will be posted

More information

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005 CSCE 750 Final Exam Answer Key Wednesday December 7, 2005 Do all problems. Put your answers on blank paper or in a test booklet. There are 00 points total in the exam. You have 80 minutes. Please note

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms CSE 101, Winter 2018 Design and Analysis of Algorithms Lecture 5: Divide and Conquer (Part 2) Class URL: http://vlsicad.ucsd.edu/courses/cse101-w18/ A Lower Bound on Convex Hull Lecture 4 Task: sort the

More information

Data Structures and Algorithms CSE 465

Data Structures and Algorithms CSE 465 Data Structures and Algorithms CSE 465 LECTURE 3 Asymptotic Notation O-, Ω-, Θ-, o-, ω-notation Divide and Conquer Merge Sort Binary Search Sofya Raskhodnikova and Adam Smith /5/0 Review Questions If input

More information

Sorting Algorithms. We have already seen: Selection-sort Insertion-sort Heap-sort. We will see: Bubble-sort Merge-sort Quick-sort

Sorting Algorithms. We have already seen: Selection-sort Insertion-sort Heap-sort. We will see: Bubble-sort Merge-sort Quick-sort Sorting Algorithms We have already seen: Selection-sort Insertion-sort Heap-sort We will see: Bubble-sort Merge-sort Quick-sort We will show that: O(n log n) is optimal for comparison based sorting. Bubble-Sort

More information

CS 310 Advanced Data Structures and Algorithms

CS 310 Advanced Data Structures and Algorithms CS 310 Advanced Data Structures and Algorithms Runtime Analysis May 31, 2017 Tong Wang UMass Boston CS 310 May 31, 2017 1 / 37 Topics Weiss chapter 5 What is algorithm analysis Big O, big, big notations

More information

Lecture 2. More Algorithm Analysis, Math and MCSS By: Sarah Buchanan

Lecture 2. More Algorithm Analysis, Math and MCSS By: Sarah Buchanan Lecture 2 More Algorithm Analysis, Math and MCSS By: Sarah Buchanan Announcements Assignment #1 is posted online It is directly related to MCSS which we will be talking about today or Monday. There are

More information

Divide and Conquer Problem Solving Method

Divide and Conquer Problem Solving Method Divide and Conquer Problem Solving Method 1. Problem Instances Let P be a problem that is amenable to the divide and conquer algorithm design method and let P 0, P 1, P 2, be distinct instances of the

More information

Divide and Conquer. Recurrence Relations

Divide and Conquer. Recurrence Relations Divide and Conquer Recurrence Relations Divide-and-Conquer Strategy: Break up problem into parts. Solve each part recursively. Combine solutions to sub-problems into overall solution. 2 MergeSort Mergesort.

More information

COMP Analysis of Algorithms & Data Structures

COMP Analysis of Algorithms & Data Structures COMP 3170 - Analysis of Algorithms & Data Structures Shahin Kamali Lecture 4 - Jan. 10, 2018 CLRS 1.1, 1.2, 2.2, 3.1, 4.3, 4.5 University of Manitoba Picture is from the cover of the textbook CLRS. 1 /

More information

Running Time Evaluation

Running Time Evaluation Running Time Evaluation Quadratic Vs. Linear Time Lecturer: Georgy Gimel farb COMPSCI 220 Algorithms and Data Structures 1 / 19 1 Running time 2 Examples 3 Big-Oh, Big-Omega, and Big-Theta Tools 4 Time

More information

Find an Element x in an Unsorted Array

Find an Element x in an Unsorted Array Find an Element x in an Unsorted Array What if we try to find a lower bound for the case where the array is not necessarily sorted? J.-L. De Carufel (U. of O.) Design & Analysis of Algorithms Fall 2017

More information