Data Structures and Algorithms
|
|
- Roderick Jenkins
- 5 years ago
- Views:
Transcription
1 Berner Fachhochschule - Technik und Informatik Data Structures and Algorithms Topic 1: Algorithm Analysis Philipp Locher FS 2018
2 Outline Course and Textbook Overview Analysis of Algorithm Pseudo-Code and Primitive Operations Growth Rate and Big-Oh Notation Topic 1: Algorithm Analysis Page 2
3 Outline Course and Textbook Overview Analysis of Algorithm Pseudo-Code and Primitive Operations Growth Rate and Big-Oh Notation Topic 1: Algorithm Analysis Page 3
4 Evaluation Project (50%) In groups of two Java implementation of selected topics Implementation and short presentation Written exam, 1.5h (50%) Last week in semester Open book E: > 50% and project, exam > 20% 4 ECTS Topic 1: Algorithm Analysis Page 4
5 Topic 1: Algorithm Analysis Page 5
6 Algorithm Design I Part I. Fundamental Tools 1. Algorithm Analysis 1.1 Methodologies for Analyzing Algorithms 1.2 Asymptotic Notation 1.3 A Quick Mathematical Review 1.4 Case Studies in Algorithm Analysis 1.5 Amortization 1.6 Experimentation 1.7 Exercises 2. Basic Data Structures 2.1 Stacks and Queues 2.2 Vectors, Lists, and Sequences 2.3 Trees 2.4 Priority Queues and Heaps 2.5 Dictionaries and Hash Tables 2.6 Java Example: Heap 2.7 Exercises 3. Search Trees and Skip Lists Topic 1: Algorithm Analysis Page 6
7 Algorithm Design II 3.1 Ordered Dictionaries and Binary Search Trees 3.2 AVL Trees 3.3 Bounded-Depth Search Trees 3.4 Splay Trees 3.5 Skip Lists 3.6 Java Example: AVL and Red-Black Trees 3.7 Exercises 4. Sorting, Sets, and Selection 4.1 Merge-Sort 4.2 The Set Abstract Data Type 4.3 Quick-Sort 4.4 A Lower Bound on Comparison-Based Sorting 4.5 Bucket-Sort and Radix-Sort 4.6 Comparison of Sorting Algorithms 4.7 Selection 4.8 Java Example: In-Place Quick-Sort 4.9 Exercises 5. Fundamental Techniques 5.1 The Greedy Method Topic 1: Algorithm Analysis Page 7
8 Algorithm Design III 5.2 Divide-and-Conquer 5.3 Dynamic Programming 5.4 Exercises Part II. Graph Algorithms 1. Graphs 1.1 The Graph Abstract Data Type 1.2 Data Structures for Graphs 1.3 Graph Traversal 1.4 Directed Graphs 1.5 Java Example: Depth-First Search 1.6 Exercises 2. Weighted Graphs 2.1 Single-Source Shortest Paths 2.2 All-Pairs Shortest Paths 2.3 Minimum Spanning Trees 2.4 Java Example: Dijkstra s Algorithm 2.5 Exercises 3. Network Flow and Matching Topic 1: Algorithm Analysis Page 8
9 Algorithm Design IV 3.1 Flows and Cuts 3.2 Maximum Flow 3.3 Maximum Bipartite Matching 3.4 Minimum-Cost Flow 3.5 Java Example: Minimum-Cost Flow 3.6 Exercises Part III. Internet Algorithmics 1. Text Processing 1.1 Strings and Pattern Matching Algorithms 1.2 Tries 1.3 Text Compression 1.4 Text Similarity Testing 1.5 Exercises 2. Number Theory and Cryptography 2.1 Fundamental Algorithms Involving Numbers 2.2 Cryptographic Computations 2.3 Information Security Algorithms and Protocols 2.4 The Fast Fourier Transform Topic 1: Algorithm Analysis Page 9
10 Algorithm Design V 2.5 Java Example: FFT 2.6 Exercises 3. Network Algorithms 3.1 Complexity Measures and Models 3.2 Fundamental Distributed Algorithms 3.3 Broadcast and Unicast Routing 3.4 Multicast Routing 3.5 Exercises Part IV. Additional Topics 1. Computational Geometry 1.1 Range Trees 1.2 Priority Search Trees 1.3 Quadtrees and k-d Trees 1.4 The Plane Sweep Technique 1.5 Convex Hulls 1.6 Java Example: Convex Hull 1.7 Exercises 2. NP-Completeness Topic 1: Algorithm Analysis Page 10
11 Algorithm Design VI 2.1 P and NP 2.2 NP-Completeness 2.3 Important NP-Complete Problems 2.4 Approximation Algorithms 2.5 Backtracking and Branch-and-Bound 2.6 Exercises 3. Algorithmic Frameworks 3.1 External-Memory Algorithms 3.2 Parallel Algorithms 3.3 Online Algorithms 3.4 Exercises Topic 1: Algorithm Analysis Page 11
12 Outline Course and Textbook Overview Analysis of Algorithm Pseudo-Code and Primitive Operations Growth Rate and Big-Oh Notation Topic 1: Algorithm Analysis Page 12
13 Algorithms An algorithm is a step-by-step procedure for solving a problem in a finite amount of time Most algorithms transform input objects into output objects The running time (and the memory consumption) of an algorithm typically grows with the input size The average case running time is often difficult to determine We focus on the worst case running time Easier to analyse Crucial to applications such as games, finance, robotics Sometimes, it is also worth to study the best case running time Topic 1: Algorithm Analysis Page 13
14 Running Time: Example Running Time Best case Average case Worst case Input Size Topic 1: Algorithm Analysis Page 14
15 Problem Classes I There are feasible problems, which can be solved by an algorithm efficiently Examples: sorting a list, draw a line between two points, decide whether n is prime, etc. There are computable problems, which can be solved by an algorithm, but not efficiently Example: finding the shortest solution for large sliding puzzles There are undecidable problems, which can not be solved by an algorithm Example: for a given a description of a program and an input, decide whether the program finishes running or will run forever (halting problem) Topic 1: Algorithm Analysis Page 15
16 Problem Classes II All Problems Computable Problems Feasible Problems Topic 1: Algorithm Analysis Page 16
17 Experimental Studies There are two ways to analyse the running time (complexity) of an algorithm: Experimental studies Theoretical analysis Experiments usually involve the following major steps: Write a program implementing the algorithm Run the program with inputs of varying size n and composition Use a method like System.currentTimeMillis() to get an accurate measure of the actual running time t(n) Plot the results Topic 1: Algorithm Analysis Page 17
18 Experimental Studies: Example Running Time (ms) Input Size Topic 1: Algorithm Analysis Page 18
19 Experimental Setup I To setup and conduct an experiment, perform each of the following steps with care 1. Choosing the question Estimate the asymptotic running time in the average case Test which of two algorithm is faster If an algorithm depends on parameters, find the best values For approximation algorithms, evaluate the quality of the approximation 2. Deciding what to measure Running time (system dependent) Number of memory references Number of primitive (e.g. arithmetic) operations Number of calls of a specific function 3. Generating test data Enough samples for statistically significant results Topic 1: Algorithm Analysis Page 19
20 Experimental Setup II Samples of varying sizes Representative of the kind of data expected in practice 4. Coding the solution and performing the experiment Reproducible results Keep note of the details of the computational environment 5. Evaluating the test results statistically Topic 1: Algorithm Analysis Page 20
21 Limits of Experiments It is necessary to implement the algorithm, which may be difficult Results may not be indicative of the running time on other inputs not included in the experiment The running times may depend strongly on the chosen setting (hardware, software, programming language) In order to compare two algorithms, the same hardware and software environments must be used Topic 1: Algorithm Analysis Page 21
22 Theoretical Analysis Uses a high-level description of the algorithm instead of an implementation Describes the running time (complexity) as a function of the input size n: T (n) = number of primitive operations Allows to evaluate the speed of an algorithm independently of hardware software programming language actual implementation Takes into account all possible inputs Topic 1: Algorithm Analysis Page 22
23 Outline Course and Textbook Overview Analysis of Algorithm Pseudo-Code and Primitive Operations Growth Rate and Big-Oh Notation Topic 1: Algorithm Analysis Page 23
24 Pseudo-Code Pseudo-code allows a high-level description of an algorithm More structured than English prose, but less detailed than a program Preferred notation for describing algorithms Hides program design issues and details of a particular language Topic 1: Algorithm Analysis Page 24
25 Pseudo-Code: Example Find the maximum element of an array: Algorithm arraymax(a, n) Input: array A of n integers Output: maximum element of A currentmax A[0] for i 1 to n 1 do if A[i] > currentmax then currentmax A[i] return currentmax Topic 1: Algorithm Analysis Page 25
26 Pseudo-Code: Example (simplified) Find the maximum element of an array: Algorithm arraymax(a, n) currentmax A[0] for i 1 to n 1 do if A[i] > currentmax then currentmax A[i] return currentmax Topic 1: Algorithm Analysis Page 26
27 Details of Pseudo-Code I The rules of using pseudo-code are very flexible, but following some guidelines is recommended Declaration Algorithm algorithmname(arg 1, arg 2,...) Input:... Output:... Control flow if... then... [else...] while... do... repeat... until... for... do... Indentation replaces braces {} resp. begin... end Topic 1: Algorithm Analysis Page 27
28 Details of Pseudo-Code II Expressions Assignments: Equality testing: = Superscript like n 2 and other mathematical notation is allowed Array access: A[i 1] Calling another algorithm algorithmname(arg 1, arg 2,...) object.algorithmname(arg 1, arg 2,...), which is equivalent to algorithmname(object, arg 1, arg 2,...) Return value return expression Topic 1: Algorithm Analysis Page 28
29 The Random Access Machine Model To study algorithms in pseudo-code analytically, we need a theoretical model of a computing machine A random access machine consists of a CPU a bank of memory cells, each of which can hold an arbitrary number (of any type and size) or character The size of the memory is unlimited Memory cells are numbered and accessing any memory cell takes 1 unit time (= random access) All primitive operations of the CPU take 1 unit time Topic 1: Algorithm Analysis Page 29
30 Primitive Operations The primitive operations of a random access machine are the once we allow in a pseudo-code algorithm Reading the value of a variable Assigning a value to a variable Evaluating an expression (arithmetic operations, comparisons) Indexing into an array Calling a method/function Returning from a method/function By inspecting the pseudo-code, we can count the number of primitive operations as a function of the input size T (n) = number of primitive operations for input of size n Largely independent from the programming language Topic 1: Algorithm Analysis Page 30
31 Primitive Operations: Example What is the running time of arraymax? Algorithm arraymax(a, n) currentmax A[0] for i 1 to n 1 do if A[i] > currentmax then currentmax A[i] return currentmax Topic 1: Algorithm Analysis Page 31
32 Primitive Operations: Example Algorithm arraymax(a, n) currentmax A[0] for i 1 to n 1 do if A[i] > currentmax then currentmax A[i] return currentmax # Operations (n 1) 3 (n 1) 2 Hence, the running time of arraymax is T (n) = 7n 2. Or did we forget something? Topic 1: Algorithm Analysis Page 32
33 Primitive Operations: Example (completed) Algorithm arraymax(a, n) currentmax A[0] for i 1 to n 1 do {i n 1} if A[i] > currentmax then currentmax A[i] {i i + 1} return currentmax # Operations n 4 (n 1) 3 (n 1) 3 (n 1) 2 Hence, the running time of arraymax is T (n) = 14n 5. Topic 1: Algorithm Analysis Page 33
34 Worst Case vs. Best Case For a given input size n, the running time of an algorithm may depend on other aspects of the input Sorting a list of size n (the list may already be sorted) Finding an element in a list of size n (the element may be at the beginning of the list) Usually, if an algorithm contains if-then-else statements, it can have different running times Worst case: maximal number of primitive operations Best case: minimal number of primitive operations Example: arraymax Worst case: T (n) = 14n 5 Best case: T (n) = 11n 2 Topic 1: Algorithm Analysis Page 34
35 Outline Course and Textbook Overview Analysis of Algorithm Pseudo-Code and Primitive Operations Growth Rate and Big-Oh Notation Topic 1: Algorithm Analysis Page 35
36 Math You Need to Review Logarithms/exponentials: a = b c log b a = c b log b a = a Properties of logarithms log b ac = log b a + log b c a log b c = log b a log b c log b a c = c log b a Properties of exponentials b a+c = b a b c b a c = (b a )/(b c ) b ac = (b a ) c = (b c ) a b (ac ) Base change: log b a = log c a log c b and bc = a c log a b Computer science: base b = 2, i.e. log a = log 2 a Topic 1: Algorithm Analysis Page 36
37 Estimating Actual Running Times In reality, the time to execute a primitive operation differs Let a be the time taken by the fastest primitive operation Let b be the time taken by the slowest primitive operation If t(n) denotes the actual running time of the algorithm on a concrete machine for a problem of size n, we get a T (n) t(n) b T (n) Changing the hardware/software environment Affects the constants a and b Therefore, affects t(n) only by a constant factor Topic 1: Algorithm Analysis Page 37
38 Asymptotic Growth Rates of Running Times The constants a and b do not change the asymptotic growth rate of t(n) Therefore, we can consider the asymptotic growth rate of T (n) as being the characteristic measure for evaluating an algorithm s running time We will use the terms number of primitive operations and running time interchangeably and denote them by T (n) The asymptotic growth rate of T (n) is an intrinsic property of the algorithm which is independent of its implementation Topic 1: Algorithm Analysis Page 38
39 Running Time Examples n 2n 2 10n log(n) 20 n 10 n log(n) Topic 1: Algorithm Analysis Page 39
40 Polynomial Running Times Feasible algorithms are those with polynomial (or better) running times: T (n) n d, d > 0 Linear: T (n) n Quadratic: T (n) n 2 Cubic: T (n) n 3 The asymptotic growth rate is not affected by constants, factors, or lower-order terms T (n) = 15n + 8 is linear T (n) = 100n is quadratic T (n) = 5n 3 + 5n 2 2n + 35 is cubic In a log-log chart, a polynomial running time turns out to be a straight line Topic 1: Algorithm Analysis Page 40
41 Log-Log Chart superpolynomial cubic Running Time T(n) quadratic linear sub- Polynomial Input Size n Topic 1: Algorithm Analysis Page 41
42 Constants and Factors Running Time T(n) n n 100n Input Size n Topic 1: Algorithm Analysis Page 42
43 Big-Oh Notation The so-called big-oh notation is useful to better compare and classify the asymptotic growth rates of different functions Given functions f (n) and g(n), we say that f (n) is O(g(n)), if there is a constant c > 0 and an integer n 0 1 such that Example 1: 2n + 10 is O(n) f (n) c g(n), for n n 0 2n + 10 c n n 10/(c 2), e.g. pick c = 3 and n 0 = 10 Example 2: n 2 is not O(n) n 2 c n n c, which can not be satisfied since c is a constant Topic 1: Algorithm Analysis Page 43
44 Big-Oh Example Running Time T(n) n +10 3n n Input Size n Topic 1: Algorithm Analysis Page 44
45 Big-Oh Example n n Running Time T(n) n n Input Size n Topic 1: Algorithm Analysis Page 45
46 Typical Running Times Constant: O(1) Logarithmic: O(log n) Linear: O(n) Quadratic: O(n 2 ) Cubic: O(n 3 ) Polynomial: O(n d ), d > 0 Exponential: O(b n ), b > 1 Others: O( n), O(n log n) Growth rate order: 1 log n n n n log n n 2 n 3 2 n 3 n Topic 1: Algorithm Analysis Page 46
47 Simplification Rules Constants, factors, and lower-order terms can be dropped 1. If f is a function and c > 0 a constant, then O(c f ) = O(f ) 2. If f and g are functions, then O(f + g) = max(o(f ), O(g)) 3. If f (n) = a d n d a 2 n 2 + a 1 n + a 0 is a polynomial of degree d, then f (n) is O(n d ) Example: f (n) = 5n 4 + 2n log n 3 is O(n 4 ) Indicate the smallest possible function, e.g., 2n + 3 is O(n) instead of 2n + 3 is O(2n) 4n 3 + 3n is O(n 3 ) instead of 4n 3 + 3n is O(n 3 + n) Topic 1: Algorithm Analysis Page 47
48 Growth Rate Comparison n log n n n n log n n 2 n 3 2 n ,096 65, ,024 32, , , ,384 2,097, ,048 65,536 16,777, , , , ,024 10,240 1,048, Atoms in the universe: ca Topic 1: Algorithm Analysis Page 48
49 The Importance of Asymptotics 1 operation/µs 256 ops./µs Running Time Maximum Problem Size n New Size 400n 2, , 000 9, 000, n 20n log n 4, , 666 7, 826, n log n 7+log n 2n , , n n n 2 n n second 1 minute 1 hour Topic 1: Algorithm Analysis Page 49
50 Summary The asymptotic analysis of an algorithm determines the running time (complexity) in big-oh notation To perform the asymptotic analysis Find the worst-case number of primitive operations T (n) Express this function with big-oh notation Example: arraymax We determine that algorithm arraymax executes at most T (n) = 14n 5 primitive operations We say that algorithm arraymax runs in O(n) time Since constant factors and lower-order terms are eventually dropped anyhow, we can disregard them when counting primitive operations Topic 1: Algorithm Analysis Page 50
Algorithms and Data Structures
Algorithm Analysis Page 1 - Algorithm Analysis Dr. Fall 2008 Algorithm Analysis Page 2 Outline Textbook Overview Analysis of Algorithm Pseudo-Code and Primitive Operations Growth Rate and Big-Oh Notation
More informationElementary maths for GMT. Algorithm analysis Part I
Elementary maths for GMT Algorithm analysis Part I Algorithms An algorithm is a step-by-step procedure for solving a problem in a finite amount of time Most algorithms transform input objects into output
More informationLECTURE 9 Data Structures: A systematic way of organizing and accessing data. --No single data structure works well for ALL purposes.
LECTURE 9 Data Structures: A systematic way of organizing and accessing data. --No single data structure works well for ALL purposes. Input Algorithm Output An algorithm is a step-by-step procedure for
More informationData Structures Lecture 8
Fall 2017 Fang Yu Software Security Lab. Dept. Management Information Systems, National Chengchi University Data Structures Lecture 8 Recap What should you have learned? Basic java programming skills Object-oriented
More informationAnalysis of Algorithms
Analysis of Algorithms Data Structures and Algorithms Acknowledgement: These slides are adapted from slides provided with Data Structures and Algorithms in C++ Goodrich, Tamassia and Mount (Wiley, 2004)
More informationOutline and Reading. Analysis of Algorithms 1
Outline and Reading Algorithms Running time ( 3.1) Pseudo-code ( 3.2) Counting primitive operations ( 3.4) Asymptotic notation ( 3.4.1) Asymptotic analysis ( 3.4.2) Case study ( 3.4.3) Analysis of Algorithms
More information9/10/2018 Algorithms & Data Structures Analysis of Algorithms. Siyuan Jiang, Sept
9/10/2018 Algorithms & Data Structures Analysis of Algorithms Siyuan Jiang, Sept. 2018 1 Email me if the office door is closed Siyuan Jiang, Sept. 2018 2 Grades have been emailed github.com/cosc311/assignment01-userid
More informationPartha Sarathi Mandal
MA 252: Data Structures and Algorithms Lecture 1 http://www.iitg.ernet.in/psm/indexing_ma252/y12/index.html Partha Sarathi Mandal Dept. of Mathematics, IIT Guwahati Time Table D / T 8-8:55 9-9:55 10-10:55
More informationANALYSIS OF ALGORITHMS
ANALYSIS OF ALGORITHMS Running Time Pseudo-Code Asymptotic Notation Asymptotic Analysis Mathematical facts T(n) n = 4 Input Algorithm Output 1 Average Case vs. Worst Case Running Time of an Algorithm An
More informationChoice of C++ as Language
EECS 281: Data Structures and Algorithms Principles of Algorithm Analysis Choice of C++ as Language All algorithms implemented in this book are in C++, but principles are language independent That is,
More informationAlgorithm Analysis. Applied Algorithmics COMP526. Algorithm Analysis. Algorithm Analysis via experiments
Applied Algorithmics COMP526 Lecturer: Leszek Gąsieniec, 321 (Ashton Bldg), L.A.Gasieniec@liverpool.ac.uk Lectures: Mondays 4pm (BROD-107), and Tuesdays 3+4pm (BROD-305a) Office hours: TBA, 321 (Ashton)
More informationData Structures and Algorithms
Asymptotic Analysis Data Structures and Algorithms Algorithm: Outline, the essence of a computational procedure, step-by-step instructions Program: an implementation of an algorithm in some programming
More informationChapter 6 INTRODUCTION TO DATA STRUCTURES AND ALGORITHMS
Chapter 6 INTRODUCTION TO DATA STRUCTURES AND ALGORITHMS 1 Reference books: The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie Programming in C (3rd Edition) by Stephen G. Kochan. Data
More informationCH ALGORITHM ANALYSIS CH6. STACKS, QUEUES, AND DEQUES
CH4.2-4.3. ALGORITHM ANALYSIS CH6. STACKS, QUEUES, AND DEQUES ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN JAVA, GOODRICH, TAMASSIA AND GOLDWASSER
More informationAlgorithm Analysis. October 12, CMPE 250 Algorithm Analysis October 12, / 66
Algorithm Analysis October 12, 2016 CMPE 250 Algorithm Analysis October 12, 2016 1 / 66 Problem Solving: Main Steps 1 Problem definition 2 Algorithm design / Algorithm specification 3 Algorithm analysis
More informationData Structures and Algorithm Analysis in C++
INTERNATIONAL EDITION Data Structures and Algorithm Analysis in C++ FOURTH EDITION Mark A. Weiss Data Structures and Algorithm Analysis in C++, International Edition Table of Contents Cover Title Contents
More information(Refer Slide Time: 1:27)
Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 1 Introduction to Data Structures and Algorithms Welcome to data
More informationCSc 225 Algorithms and Data Structures I Algorithm Analysis
CSc 225 Algorithms and Data Structures I Algorithm Analysis Jianping Pan Fall 2007 09/06/07 CSc 225 1 What is an Algorithm? An algorithm is a sequence of unambiguous instructions for solving a problem
More informationCSCA48 Winter 2018 Week 10:Algorithm Analysis. Marzieh Ahmadzadeh, Nick Cheng University of Toronto Scarborough
CSCA48 Winter 2018 Week 10:Algorithm Analysis Marzieh Ahmadzadeh, Nick Cheng University of Toronto Scarborough Algorithm Definition: Solving a problem step-by-step in finite amount of time. Analysis: How
More informationData Structures and Algorithms
Data Structures and Algorithms About the course (objectives, outline, recommended reading) Problem solving Notions of Algorithmics (growth of functions, efficiency, programming model, example analysis)
More informationAlgorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48
Algorithm Analysis (Algorithm Analysis ) Data Structures and Programming Spring 2018 1 / 48 What is an Algorithm? An algorithm is a clearly specified set of instructions to be followed to solve a problem
More informationAsymptotic Analysis of Algorithms
Asymptotic Analysis of Algorithms EECS2030 B: Advanced Object Oriented Programming Fall 2018 CHEN-WEI WANG Algorithm and Data Structure A data structure is: A systematic way to store and organize data
More informationReview for Midterm Exam
Review for Midterm Exam 1 Policies and Overview midterm exam policies overview of problems, algorithms, data structures overview of discrete mathematics 2 Sample Questions on the cost functions of algorithms
More informationIntroduction to Algorithms Third Edition
Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Clifford Stein Introduction to Algorithms Third Edition The MIT Press Cambridge, Massachusetts London, England Preface xiü I Foundations Introduction
More informationDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK Module 1 OBJECTIVE: Algorithms play the central role in both the science and the practice of computing. There are compelling reasons to study algorithms.
More informationCS 6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK
CS 6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK Page 1 UNIT I INTRODUCTION 2 marks 1. Why is the need of studying algorithms? From a practical standpoint, a standard set of algorithms from different
More informationAlgorithm. Lecture3: Algorithm Analysis. Empirical Analysis. Algorithm Performance
Algorithm (03F) Lecture3: Algorithm Analysis A step by step procedure to solve a problem Start from an initial state and input Proceed through a finite number of successive states Stop when reaching a
More informationThomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms
Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Introduction to Algorithms Preface xiii 1 Introduction 1 1.1 Algorithms 1 1.2 Analyzing algorithms 6 1.3 Designing algorithms 1 1 1.4 Summary 1 6
More informationThe Algorithm Design Manual
Steven S. Skiena The Algorithm Design Manual With 72 Figures Includes CD-ROM THE ELECTRONIC LIBRARY OF SCIENCE Contents Preface vii I TECHNIQUES 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 2 2.1 2.2 2.3
More informationINDEX. Cambridge University Press How to Think About Algorithms Jeff Edmonds Index More information
INDEX 439 abstract data type (ADT), 1, 43 exercise solutions, 414 functions vs., 43 merging with queue, 56 specifications/implementations, 44 dictionary, 47 graphs, 47 link list implementation, 51 list,
More informationDesign and Analysis of Algorithms. Comp 271. Mordecai Golin. Department of Computer Science, HKUST
Design and Analysis of Algorithms Revised 05/02/03 Comp 271 Mordecai Golin Department of Computer Science, HKUST Information about the Lecturer Dr. Mordecai Golin Office: 3559 Email: golin@cs.ust.hk http://www.cs.ust.hk/
More informationCourse Review for Finals. Cpt S 223 Fall 2008
Course Review for Finals Cpt S 223 Fall 2008 1 Course Overview Introduction to advanced data structures Algorithmic asymptotic analysis Programming data structures Program design based on performance i.e.,
More informationComputer Algorithms. Introduction to Algorithm
Computer Algorithms Introduction to Algorithm CISC 4080 Yanjun Li 1 What is Algorithm? An Algorithm is a sequence of well-defined computational steps that transform the input into the output. These steps
More informationAP Computer Science 4325
4325 Instructional Unit Algorithm Design Techniques -divide-and-conquer The students will be -Decide whether an algorithm -classroom discussion -backtracking able to classify uses divide-and-conquer, -worksheets
More informationRunning Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The
More informationChapter 1 Introduction
Preface xv Chapter 1 Introduction 1.1 What's the Book About? 1 1.2 Mathematics Review 2 1.2.1 Exponents 3 1.2.2 Logarithms 3 1.2.3 Series 4 1.2.4 Modular Arithmetic 5 1.2.5 The P Word 6 1.3 A Brief Introduction
More informationAnalysis of Algorithms
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The
More informationRunning Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.
More informationCSE 100 Advanced Data Structures
CSE 100 Advanced Data Structures Overview of course requirements Outline of CSE 100 topics Review of trees Helpful hints for team programming Information about computer accounts Page 1 of 25 CSE 100 web
More informationAnalysis of Algorithm. Chapter 2
Analysis of Algorithm Chapter 2 Outline Efficiency of algorithm Apriori of analysis Asymptotic notation The complexity of algorithm using Big-O notation Polynomial vs Exponential algorithm Average, best
More informationVirtual University of Pakistan
Virtual University of Pakistan Department of Computer Science Course Outline Course Instructor Dr. Sohail Aslam E mail Course Code Course Title Credit Hours 3 Prerequisites Objectives Learning Outcomes
More informationSankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology. Assignment
Class: V - CE Sankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology Sub: Design and Analysis of Algorithms Analysis of Algorithm: Assignment
More informationDEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: CS6402- Design & Analysis of Algorithm Year/Sem : II/IV UNIT-I INTRODUCTION
Chendu College of Engineering & Technology (Approved by AICTE, New Delhi and Affiliated to Anna University) Zamin Endathur, Madurantakam, Kancheepuram District 603311 +91-44-27540091/92 www.ccet.org.in
More informationAnalysis of Algorithms
Second Edition Design and Analysis of Algorithms Prabhakar Gupta Vineet Agarwal Manish Varshney Design and Analysis of ALGORITHMS SECOND EDITION PRABHAKAR GUPTA Professor, Computer Science and Engineering
More informationPROGRAM EFFICIENCY & COMPLEXITY ANALYSIS
Lecture 03-04 PROGRAM EFFICIENCY & COMPLEXITY ANALYSIS By: Dr. Zahoor Jan 1 ALGORITHM DEFINITION A finite set of statements that guarantees an optimal solution in finite interval of time 2 GOOD ALGORITHMS?
More informationCS240 Fall Mike Lam, Professor. Algorithm Analysis
CS240 Fall 2014 Mike Lam, Professor Algorithm Analysis Algorithm Analysis Motivation: what and why Mathematical functions Comparative & asymptotic analysis Big-O notation ("Big-Oh" in textbook) Analyzing
More information10/5/2016. Comparing Algorithms. Analyzing Code ( worst case ) Example. Analyzing Code. Binary Search. Linear Search
10/5/2016 CSE373: Data Structures and Algorithms Asymptotic Analysis (Big O,, and ) Steve Tanimoto Autumn 2016 This lecture material represents the work of multiple instructors at the University of Washington.
More informationAlgorithms and Data Structures (INF1) Lecture 15/15 Hua Lu
Algorithms and Data Structures (INF1) Lecture 15/15 Hua Lu Department of Computer Science Aalborg University Fall 2007 This Lecture Minimum spanning trees Definitions Kruskal s algorithm Prim s algorithm
More informationCourse Review. Cpt S 223 Fall 2009
Course Review Cpt S 223 Fall 2009 1 Final Exam When: Tuesday (12/15) 8-10am Where: in class Closed book, closed notes Comprehensive Material for preparation: Lecture slides & class notes Homeworks & program
More informationToday s Outline. CSE 326: Data Structures Asymptotic Analysis. Analyzing Algorithms. Analyzing Algorithms: Why Bother? Hannah Takes a Break
Today s Outline CSE 326: Data Structures How s the project going? Finish up stacks, queues, lists, and bears, oh my! Math review and runtime analysis Pretty pictures Asymptotic analysis Hannah Tang and
More informationCSE373: Data Structures & Algorithms Lecture 28: Final review and class wrap-up. Nicki Dell Spring 2014
CSE373: Data Structures & Algorithms Lecture 28: Final review and class wrap-up Nicki Dell Spring 2014 Final Exam As also indicated on the web page: Next Tuesday, 2:30-4:20 in this room Cumulative but
More informationTopic Analysis PART-A
Govt. of Karnataka, Department of Technical Education Diploma in Information Science & Engineering Third Semester Subject: ANALYSIS AND DESIGN OF ALGORITHM Contact Hrs / week: Total hrs: 64 Topic Analysis
More informationDepartment of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I
MCA 312: Design and Analysis of Algorithms [Part I : Medium Answer Type Questions] UNIT I 1) What is an Algorithm? What is the need to study Algorithms? 2) Define: a) Time Efficiency b) Space Efficiency
More informationAdvanced Algorithms and Data Structures
Advanced Algorithms and Data Structures Prof. Tapio Elomaa tapio.elomaa@tut.fi Course Prerequisites A seven credit unit course Replaced OHJ-2156 Analysis of Algorithms We take things a bit further than
More informationDATA STRUCTURES AND ALGORITHMS
DATA STRUCTURES AND ALGORITHMS For COMPUTER SCIENCE DATA STRUCTURES &. ALGORITHMS SYLLABUS Programming and Data Structures: Programming in C. Recursion. Arrays, stacks, queues, linked lists, trees, binary
More informationCSE 332 Winter 2015: Midterm Exam (closed book, closed notes, no calculators)
_ UWNetID: Lecture Section: A CSE 332 Winter 2015: Midterm Exam (closed book, closed notes, no calculators) Instructions: Read the directions for each question carefully before answering. We will give
More informationUniversity of Toronto Department of Electrical and Computer Engineering. Midterm Examination. ECE 345 Algorithms and Data Structures Fall 2012
1 University of Toronto Department of Electrical and Computer Engineering Midterm Examination ECE 345 Algorithms and Data Structures Fall 2012 Print your name and ID number neatly in the space provided
More informationCLASS: II YEAR / IV SEMESTER CSE CS 6402-DESIGN AND ANALYSIS OF ALGORITHM UNIT I INTRODUCTION
CLASS: II YEAR / IV SEMESTER CSE CS 6402-DESIGN AND ANALYSIS OF ALGORITHM UNIT I INTRODUCTION 1. What is performance measurement? 2. What is an algorithm? 3. How the algorithm is good? 4. What are the
More informationasymptotic growth rate or order compare two functions, but ignore constant factors, small inputs
Big-Oh 1 asymptotic growth rate or order 2 compare two functions, but ignore constant factors, small inputs asymptotic growth rate or order 2 compare two functions, but ignore constant factors, small inputs
More informationECE6095: CAD Algorithms. Optimization Techniques
ECE6095: CAD Algorithms Optimization Techniques Mohammad Tehranipoor ECE Department 6 September 2010 1 Optimization Techniques Objective: A basic review of complexity Review of basic algorithms Some physical
More informationCS-6402 DESIGN AND ANALYSIS OF ALGORITHMS
CS-6402 DESIGN AND ANALYSIS OF ALGORITHMS 2 marks UNIT-I 1. Define Algorithm. An algorithm is a sequence of unambiguous instructions for solving a problem in a finite amount of time. 2.Write a short note
More informationOutline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis
Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis
More informationAlgorithms (IX) Guoqiang Li. School of Software, Shanghai Jiao Tong University
Algorithms (IX) Guoqiang Li School of Software, Shanghai Jiao Tong University Q: What we have learned in Algorithm? Algorithm Design Algorithm Design Basic methodologies: Algorithm Design Algorithm Design
More informationComplexity. Alexandra Silva.
Complexity Alexandra Silva alexandra@cs.ru.nl http://www.cs.ru.nl/~alexandra Institute for Computing and Information Sciences 6th February 2013 Alexandra 6th February 2013 Lesson 1 1 / 39 Introduction
More informationASYMPTOTIC COMPLEXITY
Simplicity is a great virtue but it requires hard work to achieve it and education to appreciate it. And to make matters worse: complexity sells better. - Edsger Dijkstra ASYMPTOTIC COMPLEXITY Lecture
More informationL6,7: Time & Space Complexity
Indian Institute of Science Bangalore, India भ रत य व ज ञ न स स थ न ब गल र, भ रत Department of Computational and Data Sciences DS286 2016-08-31,09-02 L6,7: Time & Space Complexity Yogesh Simmhan s i m
More informationCSE 146. Asymptotic Analysis Interview Question of the Day Homework 1 & Project 1 Work Session
CSE 146 Asymptotic Analysis Interview Question of the Day Homework 1 & Project 1 Work Session Comparing Algorithms Rough Estimate Ignores Details Or really: independent of details What are some details
More informationSelection, Bubble, Insertion, Merge, Heap, Quick Bucket, Radix
Spring 2010 Review Topics Big O Notation Heaps Sorting Selection, Bubble, Insertion, Merge, Heap, Quick Bucket, Radix Hashtables Tree Balancing: AVL trees and DSW algorithm Graphs: Basic terminology and
More informationTheory and Algorithms Introduction: insertion sort, merge sort
Theory and Algorithms Introduction: insertion sort, merge sort Rafael Ramirez rafael@iua.upf.es Analysis of algorithms The theoretical study of computer-program performance and resource usage. What s also
More informationCS583 Lecture 01. Jana Kosecka. some materials here are based on Profs. E. Demaine, D. Luebke A.Shehu, J-M. Lien and Prof. Wang s past lecture notes
CS583 Lecture 01 Jana Kosecka some materials here are based on Profs. E. Demaine, D. Luebke A.Shehu, J-M. Lien and Prof. Wang s past lecture notes Course Info course webpage: - from the syllabus on http://cs.gmu.edu/
More informationCSci 231 Final Review
CSci 231 Final Review Here is a list of topics for the final. Generally you are responsible for anything discussed in class (except topics that appear italicized), and anything appearing on the homeworks.
More informationData structure and algorithm in Python
Data structure and algorithm in Python Algorithm Analysis Xiaoping Zhang School of Mathematics and Statistics, Wuhan University Table of contents 1. Experimental studies 2. The Seven Functions used in
More informationLecture 1. Introduction
Lecture 1 Introduction 1 Lecture Contents 1. What is an algorithm? 2. Fundamentals of Algorithmic Problem Solving 3. Important Problem Types 4. Fundamental Data Structures 2 1. What is an Algorithm? Algorithm
More informationCpt S 223 Fall Cpt S 223. School of EECS, WSU
Course Review Cpt S 223 Fall 2012 1 Final Exam When: Monday (December 10) 8 10 AM Where: in class (Sloan 150) Closed book, closed notes Comprehensive Material for preparation: Lecture slides & class notes
More informationWhat is an Algorithm?
What is an Algorithm? Step-by-step procedure used to solve a problem These steps should be capable of being performed by a machine Must eventually stop and so produce an answer Types of Algorithms Iterative
More informationData Structures and Algorithms. Analysis of Algorithms
Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output
More informationIntroduction p. 1 Pseudocode p. 2 Algorithm Header p. 2 Purpose, Conditions, and Return p. 3 Statement Numbers p. 4 Variables p. 4 Algorithm Analysis
Introduction p. 1 Pseudocode p. 2 Algorithm Header p. 2 Purpose, Conditions, and Return p. 3 Statement Numbers p. 4 Variables p. 4 Algorithm Analysis p. 5 Statement Constructs p. 5 Pseudocode Example p.
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 12: Sorting Algorithms MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Outline 2 Last week Implementation of the three tree depth-traversal algorithms Implementation of the BinarySearchTree
More informationCS302 Topic: Algorithm Analysis. Thursday, Sept. 22, 2005
CS302 Topic: Algorithm Analysis Thursday, Sept. 22, 2005 Announcements Lab 3 (Stock Charts with graphical objects) is due this Friday, Sept. 23!! Lab 4 now available (Stock Reports); due Friday, Oct. 7
More informationCS:3330 (22c:31) Algorithms
What s an Algorithm? CS:3330 (22c:31) Algorithms Introduction Computer Science is about problem solving using computers. Software is a solution to some problems. Algorithm is a design inside a software.
More informationCS240 Fall Mike Lam, Professor. Algorithm Analysis
CS240 Fall 2014 Mike Lam, Professor Algorithm Analysis HW1 Grades are Posted Grades were generally good Check my comments! Come talk to me if you have any questions PA1 is Due 9/17 @ noon Web-CAT submission
More informationAdvanced Algorithms and Data Structures
Advanced Algorithms and Data Structures Prof. Tapio Elomaa Course Basics A new 7 credit unit course Replaces OHJ-2156 Analysis of Algorithms We take things a bit further than OHJ-2156 We will assume familiarity
More informationASSIGNMENTS. Progra m Outcom e. Chapter Q. No. Outcom e (CO) I 1 If f(n) = Θ(g(n)) and g(n)= Θ(h(n)), then proof that h(n) = Θ(f(n))
ASSIGNMENTS Chapter Q. No. Questions Course Outcom e (CO) Progra m Outcom e I 1 If f(n) = Θ(g(n)) and g(n)= Θ(h(n)), then proof that h(n) = Θ(f(n)) 2 3. What is the time complexity of the algorithm? 4
More informationEND-TERM EXAMINATION
(Please Write your Exam Roll No. immediately) Exam. Roll No... END-TERM EXAMINATION Paper Code : MCA-205 DECEMBER 2006 Subject: Design and analysis of algorithm Time: 3 Hours Maximum Marks: 60 Note: Attempt
More informationCS201 Design and Analysis of Algorithms Max.Marks:75
Syllabus for M.Sc. Computer Science Programme Semester II CS 201 Design and Analysis of Algorithms 100 ( 75 + 25 ) CS 202 Data Communication and Computer Network 100 ( 75 + 25 ) CS 203 Optimization Techniques
More informationASYMPTOTIC COMPLEXITY
Simplicity is a great virtue but it requires hard work to achieve it and education to appreciate it. And to make matters worse: complexity sells better. - Edsger Dijkstra ASYMPTOTIC COMPLEXITY Lecture
More informationCS171:Introduction to Computer Science II. Algorithm Analysis. Li Xiong
CS171:Introduction to Computer Science II Algorithm Analysis Li Xiong Announcement/Reminders Hw3 due Friday Quiz 2 on October 17, Wednesday (after Spring break, based on class poll) Linked List, Algorithm
More informationCSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid. Fall 2018
CSCE 20/220 Data Structures and Algorithms Prof. Amr Goneid Fall 208 CSCE 20/220 DATA STRUCTURES AND ALGORITHMS Dr. Amr Goneid Course Goals To introduce concepts of Data Models, Data Abstraction and ADTs
More informationCpt S 223 Course Overview. Cpt S 223, Fall 2007 Copyright: Washington State University
Cpt S 223 Course Overview 1 Course Goals Learn about new/advanced data structures Be able to make design choices on the suitable data structure for different application/problem needs Analyze (objectively)
More informationAlgorithms and Data Structures, or
Algorithms and Data Structures, or... Classical Algorithms of the 50s, 60s and 70s Mary Cryan A&DS Lecture 1 1 Mary Cryan Our focus Emphasis is Algorithms ( Data Structures less important). Most of the
More informationアルゴリズムの設計と解析 (W4022) 教授 : 黄潤和 広野史明 (A4/A10)
アルゴリズムの設計と解析 教授 : 黄潤和 SA: (W4022) rhuang@hosei.ac.jp 広野史明 (A4/A10) fumiaki.hirono.5k@stu.hosei.ac.jp Goal 到達目標 : The objectives of this course are to make students firmly laying good foundation of data
More informationRecitation 9. Prelim Review
Recitation 9 Prelim Review 1 Heaps 2 Review: Binary heap min heap 1 2 99 4 3 PriorityQueue Maintains max or min of collection (no duplicates) Follows heap order invariant at every level Always balanced!
More informationAbout this exam review
Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review
More informationIntroduction to Computer Science
Introduction to Computer Science Program Analysis Ryan Stansifer Department of Computer Sciences Florida Institute of Technology Melbourne, Florida USA 32901 http://www.cs.fit.edu/ ryan/ 24 April 2017
More informationCOMP251: Algorithms and Data Structures. Jérôme Waldispühl School of Computer Science McGill University
COMP251: Algorithms and Data Structures Jérôme Waldispühl School of Computer Science McGill University About Me Jérôme Waldispühl Associate Professor of Computer Science I am conducting research in Bioinformatics
More informationIntroduction to the Analysis of Algorithms. Algorithm
Introduction to the Analysis of Algorithms Based on the notes from David Fernandez-Baca Bryn Mawr College CS206 Intro to Data Structures Algorithm An algorithm is a strategy (well-defined computational
More informationModule 1: Asymptotic Time Complexity and Intro to Abstract Data Types
Module 1: Asymptotic Time Complexity and Intro to Abstract Data Types Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu
More informationCSE 373 APRIL 3 RD ALGORITHM ANALYSIS
CSE 373 APRIL 3 RD ALGORITHM ANALYSIS ASSORTED MINUTIAE HW1P1 due tonight at midnight HW1P2 due Friday at midnight HW2 out tonight Second Java review session: Friday 10:30 ARC 147 TODAY S SCHEDULE Algorithm
More informationClassic Data Structures Introduction UNIT I
ALGORITHM SPECIFICATION An algorithm is a finite set of instructions that, if followed, accomplishes a particular task. All algorithms must satisfy the following criteria: Input. An algorithm has zero
More informationL.J. Institute of Engineering & Technology Semester: VIII (2016)
Subject Name: Design & Analysis of Algorithm Subject Code:1810 Faculties: Mitesh Thakkar Sr. UNIT-1 Basics of Algorithms and Mathematics No 1 What is an algorithm? What do you mean by correct algorithm?
More information