CES 592 Theory of Software Systems B. Ravikumar (Ravi) Office: 124 Darwin Hall.

Slides:



Advertisements
Similar presentations
MATH 224 – Discrete Mathematics
Advertisements

Analysis of Algorithms
Lecture 12: Revision Lecture Dr John Levine Algorithms and Complexity March 27th 2006.
Algorithms Recurrences. Definition – a recurrence is an equation or inequality that describes a function in terms of its value on smaller inputs Example.
Computational Complexity 1. Time Complexity 2. Space Complexity.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Midterm Review Fri. Oct 26.
CS333 Algorithms
Jan Welcome to the Course of Advanced Algorithm Design (ACS-7101/3)
Fall 2006CENG 7071 Algorithm Analysis. Fall 2006CENG 7072 Algorithmic Performance There are two aspects of algorithmic performance: Time Instructions.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2009 Lecture 1 Introduction/Overview Text: Chapters 1, 2 Th. 9/3/2009.
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
1 Data Structures A program solves a problem. A program solves a problem. A solution consists of: A solution consists of:  a way to organize the data.
CSE 830: Design and Theory of Algorithms Dr. Eric Torng.
Lecture 3 Aug 31, 2011 Goals: Chapter 2 (algorithm analysis) Examples: Selection sorting rules for algorithm analysis discussion of lab – permutation generation.
Algorithm Analysis CS 201 Fundamental Structures of Computer Science.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 2 Elements of complexity analysis Performance and efficiency Motivation: analysis.
Chapter 11: Limitations of Algorithmic Power
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2005 Lecture 1 Introduction/Overview Text: Chapters 1, 2 Wed. 9/7/05.
Analysis of Algorithms 7/2/2015CS202 - Fundamentals of Computer Science II1.
Summary of Algo Analysis / Slide 1 Algorithm complexity * Bounds are for the algorithms, rather than programs n programs are just implementations of an.
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
Introduction to Algorithm design and analysis
Analysis of Algorithms Spring 2015CS202 - Fundamentals of Computer Science II1.
COMP s1 Computing 2 Complexity
Algorithm Design and Analysis Liao Minghong School of Computer Science and Technology of HIT July, 2003.
Teaching Teaching Discrete Mathematics and Algorithms & Data Structures Online G.MirkowskaPJIIT.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2002 Lecture 1 Introduction/Overview Text: Chapters 1, 2 Thurs.
Lecture 2 We have given O(n 3 ), O(n 2 ), O(nlogn) algorithms for the max sub-range problem. This time, a linear time algorithm! The idea is as follows:
Program Performance & Asymptotic Notations CSE, POSTECH.
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
2.3 Functions A function is an assignment of each element of one set to a specific element of some other set. Synonymous terms: function, assignment, map.
Lecture 2 Computational Complexity
Algorithm Efficiency CS 110: Data Structures and Algorithms First Semester,
Mathematics Review and Asymptotic Notation
1 Computer Algorithms Lecture 3 Asymptotic Notation Some of these slides are courtesy of D. Plaisted, UNC and M. Nicolescu, UNR.
CS 3343: Analysis of Algorithms
10/13/20151 CS 3343: Analysis of Algorithms Lecture 9: Review for midterm 1 Analysis of quick sort.
Chapter 3 Sec 3.3 With Question/Answer Animations 1.
Lecture 1: Introduction and Overview CSCI 700 – Algorithms 1.
Algorithms  Al-Khwarizmi, arab mathematician, 8 th century  Wrote a book: al-kitab… from which the word Algebra comes  Oldest algorithm: Euclidian algorithm.
A Lecture /24/2015 COSC3101A: Design and Analysis of Algorithms Tianying Ji Lecture 1.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
1Computer Sciences Department. Book: Introduction to Algorithms, by: Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Clifford Stein Electronic:
INTRODUCTION. What is an algorithm? What is a Problem?
September 17, 2001 Algorithms and Data Structures Lecture II Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Lecture 3 Analysis of Algorithms, Part II. Plan for today Finish Big Oh, more motivation and examples, do some limit calculations. Little Oh, Theta notation.
HKOI 2005 Training Introduction to Algorithms Alan, Tam Siu Lung.
September 9, Algorithms and Data Structures Lecture II Simonas Šaltenis Nykredit Center for Database Research Aalborg University
1/6/20161 CS 3343: Analysis of Algorithms Lecture 2: Asymptotic Notations.
ADVANCED ALGORITHMS REVIEW OF ANALYSIS TECHNIQUES (UNIT-1)
Design and Analysis of Algorithms (09 Credits / 5 hours per week) Sixth Semester: Computer Science & Engineering M.B.Chandak
Computer Science/Ch. Algorithmic Foundation of CS 4-1 Chapter 4 Chapter 4 Algorithmic Foundation of Computer Science.
CES 512 Theory of Software Systems B. Ravikumar (Ravi) Office: 141 Darwin Hall Course Web site:
CES 512 Theory of Software Systems B. Ravikumar (Ravi) Office: 141 Darwin Hall Course Web site:
Design and Analysis of Algorithms Introduction Instructors:1. B V Kiran Mayee, 2. A Madhavi
Big O David Kauchak cs302 Spring Administrative Assignment 1: how’d it go? Assignment 2: out soon… Lab code.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
Analysis of Algorithms Spring 2016CS202 - Fundamentals of Computer Science II1.
GC 211:Data Structures Week 2: Algorithm Analysis Tools Slides are borrowed from Mr. Mohammad Alqahtani.
September 18, Algorithms and Data Structures Lecture II Simonas Šaltenis Aalborg University
Design and Analysis of Algorithms (09 Credits / 5 hours per week)
Design and Analysis of ALGORITHM (Session 1)
Introduction Algorithms Order Analysis of Algorithm
CS 3343: Analysis of Algorithms
Design and Analysis of Computer Algorithm (CS575-01)
Design and Analysis of Algorithms (07 Credits / 4 hours per week)
Objective of This Course
INTRODUCTION TO ALOGORITHM DESIGN STRATEGIES
Department of Computer Science & Engineering
Design and Analysis of Algorithms (04 Credits / 4 hours per week)
Presentation transcript:

CES 592 Theory of Software Systems B. Ravikumar (Ravi) Office: 124 Darwin Hall

Course Goals: tools for algorithm design graph searching, flow, matching,... linear programming dynamic programming randomization divide and conquer, induction,... tools for analysis recurrence relations, summation etc. reducibility experimental analysis algorithmic modeling formal systems and their applications logic grammars, automata

Goals for today’s lecture Introductions Answer the questionnaire Work on Quiz # 0 Overview of the course Begin review of Discrete Math

Algorithm Design and Analysis Efficient algorithms are a crucial part of software design tinkering with implementation and coding details can’t get us very far. root of the problem may be an inefficient algorithm. optimization problems allow multiple “correct” solutions, but only one correct and optimal solution. correctness of algorithms can be tricky to establish. predicting the behavior of algorithm is an important part of software design.

Some standard approaches to systematic algorithm design identify commonly occurring problems (such as sorting, searching, multiplication, breadth-first search etc.) and design the most efficient algorithms for them. devise general-purpose techniques (induction, divide and conquer, backtracking, dynamic programming etc.) and study when they are effective by looking at many examples. create and study models (such as trees, graphs, probabilistic algorithms) that can be used to represent problems and solutions.

Analysis of algorithms time taken to solve a problem as a function of problem size usually behaves as a well- defined function (logarithmic, linear, quadratic, n log n, exponential, etc.) when the time complexity function is complicated, it can be approximated to a well-defined function. problems can be classified based on the time complexity into easy (polynomial time solvable), provably intractable (not polynomial time solvable) and hard (not known to be polynomial time solvable, and not likely to be so).

Formal Systems and Languages Specification of software describing the syntax of a programming language (or even parts of natural language to a computer) automata applications string processing problems protocol specification and verification machine learning

Example: Arrange numbers 1, 2,..., 15 in a cyclic order so that the sum of every three consecutive numbers is at most 24. Why was 24 chosen? Can we solve this problem with 23 replacing 24? Systematically trying all permutations. Why is this not a good idea? The problem has multiple solutions. So we can try some random sequences. Algorithm for random permutation generation.

Course overview: Mathematical preliminaries induction summation, approximation, estimation inequalities, upper and lower bounds O,  and  notation recurrence relations review of discrete math Sorting and related problems quadratic time sorting algorithms heap sort and merge sort quick sort selection problem non-comparison based algorithms

Searching binary search tree AVL trees application to a geometric problem hashing Design Techniques divide and conquer dynamic programming greedy method probabilistic method backtracking genetic algorithms, neural networks etc.(?)

Graph Problems basic definitions and models DFS, BFS and applications minimum spanning tree shortest path problem matching in a bipartite graph Formal Systems and Applications finite automata context-free languages predicate logic applications

NP-completeness, decision trees etc. Lower-bound - models reductions Miscellaneous Topics string-matching cryptography parallel computers

Insertion Sorting Efficient algorithm for sorting a small number of elements. Insert(A,i) {// pre-condition: A[0.. i-1] is sorted. //post-condition: A[0.. i] is sorted. temp = A[i]; while (A[i-1] > temp) {A[i] = A[i-1]; i--;} A[i] = temp; } InsertionSort(A) { for (j = 2; j<= A.size; ++j) Insert(A,j) }

Our pseudo-code style is a little different from that of the text. (Ours will be a lot closer to Java or C++.) Analysis of InsertionSort: Focus on a specific operation. (key comparison). Text considers every operation. Measured as a function of parameter(s). In this case, it is the size of the array. Cost of the operation is a constant (1). Cases of interest: worst-case best-case average-case

Insert(A,i) {// pre-condition: A[0.. i-1] is sorted. //post-condition: A[0.. i] is sorted. temp = A[i]; while (A[i-1] > temp) {A[i] = A[i-1]; i--;} A[i] = temp; } worst-case: i best-case: 1 average: will do later. InsertionSort(A) { for (j = 1; j<= A.size; ++j) Insert(A,j) } worst-case: n(n-1)/2 best-case: n

Review of background material Mathematical Preliminaries induction - proof technique for assertion of the form “ for all integer n,... ” Example 1: For all n, n 3 + 5n is divisible by 6. Example r + … + r k = (r k+1 – 1)/(r-1) Proof by induction on k.

Inequalities, O,  and  notation For any positive real constants c and d, c n > n d for all sufficiently large n. There are positive constants c 1 and c 2 such that for all n, c 1 n log n <= log n! <= c 2 n log n. Definition: Let f(n) and g(n) be such that f(n) <= c g(n) for all large enough n. Then, we say f(n) = O(g(n)). If =, we have f(n) =  (g(n)). If both hold, f(n) =  (g(n)).

From previous slide, we have: log n! =  (n log n) Exercise: 1) 1 + 1/2+ 1/ /n =  (log n) 2) 1 + 1/ / /n 2 =  (1) 3) Estimate 1/2 + 2/ / n/2 n Summation formulas for arithmetic, geometric and arithmetic-geometric series