UMass Lowell Computer Science 91.404 Analysis of Algorithms Prof. Karen Daniels Fall, 2000 Final Review Wed. 12/13.

Slides:



Advertisements
Similar presentations
Algorithms (and Datastructures) Lecture 3 MAS 714 part 2 Hartmut Klauck.
Advertisements

© The McGraw-Hill Companies, Inc., Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Divide-and-Conquer Recursive in structure –Divide the problem into several smaller sub-problems that are similar to the original but smaller in size –Conquer.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Midterm Review Fri. Oct 26.
Jan Welcome to the Course of Advanced Algorithm Design (ACS-7101/3)
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 1 (Part 1) Introduction/Overview Tuesday, 9/4/01.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2009 Heap Lecture Chapter 6 Use NOTES feature to see explanation.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2005 Lecture 1 (Part 1) Introduction/Overview Tuesday, 1/25/05.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2009 Lecture 1 Introduction/Overview Text: Chapters 1, 2 Th. 9/3/2009.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2003 Final Review Wed. 12/10 – Fri. 12/12.
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Final Review.
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2006 Lecture 2 Monday, 2/6/06 Design Patterns for Optimization.
Chapter 4: Divide and Conquer The Design and Analysis of Algorithms.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2003 Review Lecture Tuesday, 5/6/03.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2006 Lecture 2 Monday, 9/13/06 Design Patterns for Optimization Problems.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2006 Text: Chapter 3 Growth of Functions.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 3 Recurrence equations Formulating recurrence equations Solving recurrence equations.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2002 Lecture 1 (Part 1) Introduction/Overview Tuesday, 9/3/02.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2009 Final Review.
Course Review COMP171 Spring Hashing / Slide 2 Elementary Data Structures * Linked lists n Types: singular, doubly, circular n Operations: insert,
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 3 Recurrence equations Formulating recurrence equations Solving recurrence equations.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2002 Review Lecture Tuesday, 12/10/02.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 1 Introduction/Overview Wed. 9/5/01.
CS 206 Introduction to Computer Science II 04 / 29 / 2009 Instructor: Michael Eckmann.
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
CS 206 Introduction to Computer Science II 12 / 10 / 2008 Instructor: Michael Eckmann.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lectures 2, 3 Chapters 1, 2 Fri. 9/7/01 – Mon. 9/10/01.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2005 Lecture 1 Introduction/Overview Text: Chapters 1, 2 Wed. 9/7/05.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 1 (Part 1) Introduction/Overview Wednesday, 9/8/04.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2007 Lecture 1 Introduction/Overview Text: Chapters 1, 2 Wed. 1/24/07.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2001 Lecture 1 Introduction/Overview Wed. 1/31/01.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2000 Lecture 1 Introduction/Overview Wed. 9/6/00.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2008 Lecture 2 Tuesday, 9/16/08 Design Patterns for Optimization.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2007 Heap Lecture Chapter 6 Use NOTES feature to see explanation.
The Complexity of Algorithms and the Lower Bounds of Problems
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2002 Lecture 1 (Part 1) Introduction/Overview Tuesday, 1/29/02.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2001 Final Review Mon. 5/14-Wed. 5/16.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Heap Lecture 2 Chapter 7 Wed. 10/10/01 Use NOTES feature to.
Text Chapters 1, 2. Sorting ä Sorting Problem: ä Input: A sequence of n numbers ä Output: A permutation (reordering) of the input sequence such that:
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2002 Lecture 1 Introduction/Overview Text: Chapters 1, 2 Thurs.
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
Analysis of Algorithms
Analyzing Recursive Algorithms A recursive algorithm can often be described by a recurrence equation that describes the overall runtime on a problem of.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Course Review Midterm.
David Luebke 1 10/16/2015 CS 332: Algorithms Go Over Midterm Intro to Graph Algorithms.
Algorithm Analysis PS5 due 11:59pm Wednesday, April 18 Final Project Phase 2 (Program Outline) due 1:30pm Tuesday, April 24 Wellesley College CS230.
10/20/20151 CS 3343: Analysis of Algorithms Review for final.
CMPT 438 Algorithms. Why Study Algorithms? Necessary in any computer programming problem ▫Improve algorithm efficiency: run faster, process more data,
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2009 Lecture 1 (Part 1) Introduction/Overview Tuesday, 1/27/09.
1 BIM304: Algorithm Design Time: Friday 9-12am Location: B4 Instructor: Cuneyt Akinlar Grading –2 Midterms – 20% and 30% respectively –Final – 30% –Projects.
LIMITATIONS OF ALGORITHM POWER
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 23 Algorithm Efficiency.
تصميم وتحليل الخوارزميات عال311 Chapter 3 Growth of Functions
CS 150: Analysis of Algorithms. Goals for this Unit Begin a focus on data structures and algorithms Understand the nature of the performance of algorithms.
Copyright © 2007 Pearson Addison-Wesley. All rights reserved. A. Levitin “ Introduction to the Design & Analysis of Algorithms, ” 2 nd ed., Ch. 1 Chapter.
CES 512 Theory of Software Systems B. Ravikumar (Ravi) Office: 141 Darwin Hall Course Web site:
CES 592 Theory of Software Systems B. Ravikumar (Ravi) Office: 124 Darwin Hall.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Review Lecture Tuesday, 12/11/01.
Design and Analysis of Algorithms Introduction Instructors:1. B V Kiran Mayee, 2. A Madhavi
Course Review Fundamental Structures of Computer Science Margaret Reid-Miller 28 April 2005.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2008 Final Review.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Final Review Mon. 12/10-Wed. 12/12.
Lecture 1 (Part 1) Introduction/Overview Tuesday, 9/9/08
Lecture 1 Introduction/Overview Text: Chapters 1, 2 Wed. 1/28/04
Department of Computer Science & Engineering
Presentation transcript:

UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2000 Final Review Wed. 12/13

Overview of Today’s Lecture ä Course Grade ä Final Exam: ä Logistics, Coverage, Format ä Handout for basis of 40% of test ä Review of some key course material ä Course Evaluations

Course Grading ä ä Homework 40% ä ä Exam 1 10% (closed book) ä ä Exam 2 15% (open book) ä ä Exam 3 15% (open book) ä ä Final Exam 20% (open book) Results are scaled if necessary.

Final Exam: Logistics ä Saturday, 12/16 ä Olsen 410: 8:00-10:00 a.m. ä Open book, open notes ä Closed computers, neighbors ä Cumulative ä Worth 20% of grade Moved to OS 311

Text/Chapter Coverage ä Discrete Math Review: Chapters 1-6 ä Growth of Functions, Summations, Recurrences, Sets, Counting, Probability ä Sorting: Chapters 7-10 ä Heapsort, Quicksort, LinearTime-Sorting, Medians ä Data Structures: Chapters ä Stacks, Queues, LinkedLists, Trees, HashTables, Binary Search Trees, Balanced Trees ä Advanced Techniques: Chapters ä Dynamic Programming, Greedy Algorithms ä Graph Algorithms: Chapters ä Traversals, MinimumSpanningTrees, Shortest Paths

Format ä This exam will have a mixture of questions of the following types: 1) Multiple Choice 2) Short Answer/ Pseudo-code analysis 3) Design an Algorithm (based on PatrioticTree handout) - Write pseudo-code - Justify correctness - Justify correctness - Analyze asymptotic complexity - Analyze asymptotic complexity

FINAL EXAM HANDOUT Patriotic Trees 40% of the Final Exam is based on the representation defined here. (This material is already on our Web site. )

PatrioticTree We define a PatrioticTree to be a binary tree of n nodes in which: - - Every internal node has both a left and a right child. - - Each node is labeled with a single color (R, W or B) - - Each node has a weight. The weight is a pair of integer values and is of the form. The first integer value in the pair is the Red Weight of the node = Red Weight of the node’s left child + Red Weight of the node’s right child. The second integer value in the pair is the Blue Weight of the node = Blue Weight of the node’s left child + Blue Weight of the node’s right child. The color of a node is determined as follows: - - R if its Red Weight exceeds its Blue Weight - - B if its Blue Weight exceeds its Red Weight - - W if its Blue Weight equals its Red Weight - - The weight of each W leaf is. - - The weight of each R leaf is of the form. - - The weight of each B leaf is of the form.

PatrioticTree: Example W R B R B W W B R B B B B B B

PatrioticTree: Representation For algorithmic purposes, we represent a PatrioticTree as follows: A TreeNode represents a node of a PatrioticTree. It contains the attributes: - color: a character representing its color: “R”, “B” or “W” - r: an integer representing its Red Weight - b: an integer representing its Blue Weight - parent: a pointer to the parent of this node - left: a pointer to the left subtree of this node - right: a pointer to the right subtree of this node You can access a node’s attributes using the “.” notation (e.g. for a TreeNode t, t.color gives its color and t.left accesses its left subtree). color r parent left b right

PatrioticTree: Representation Example B 62 B 83 B 50 W 33 B 87 B 62 B 149 R 04 R 02 R 03 B 50 B 30 B 60 W 00 W 00

What’s It All About? ä Algorithm: ä steps for the computer to follow to solve a problem ä Some of our goals: ä recognize structure of some common problems ä understand important characteristics of algorithms to solve common problems ä select appropriate algorithm to solve a problem ä tailor existing algorithms ä create new algorithms

Some Algorithm Application Areas Computer Graphics Geographic Information Systems Robotics Bioinformatics Astrophysics Medical Imaging Telecommunications Design Apply Analyze

Tools of the Trade ä Algorithm Design Patterns such as: ä binary search ä divide-and-conquer ä Data Structures such as: ä trees, linked lists, hash tables, graphs ä Theoretical Computer Science principles such as: ä NP-completeness, hardness Growth of Functions Summations Recurrences Sets Probability MATH Proofs

Discrete Math Review Chapters 1-6 Growth of Functions, Summations, Recurrences, Sets, Counting, Probability

What are we measuring? ä Some Analysis Criteria: ä Scope ä The problem itself? ä A particular algorithm that solves the problem? ä “Dimension” ä Time Complexity? Space Complexity? ä Type of Bound ä Upper? Lower? Both? ä Type of Input ä Best-Case? Average-Case? Worst-Case? ä Type of Implementation ä Choice of Data Structure

Function Order of Growth O( ) upper bound  ( ) lower bound  ( ) upper & lower bound n 1 n lg(n) n lg 2 (n) 2n2n2n2n n5n5n5n5 lg(n) lg(n)lglg(n) n2n2n2n2 know how to use asymptotic complexity notation to describe time or space complexity know how to order functions asymptotically (behavior as n becomes large)

Types of Algorithmic Input Best-Case Input: of all possible algorithm inputs of size n, it generates the “best” result for Time Complexity: “best” is smallest running time for Time Complexity: “best” is smallest running time Best-Case Input Produces Best-Case Running Time Best-Case Input Produces Best-Case Running Time provides a lower bound on the algorithm’s asymptotic running time provides a lower bound on the algorithm’s asymptotic running time (subject to any implementation assumptions) (subject to any implementation assumptions) for Space Complexity: “best” is smallest storage for Space Complexity: “best” is smallest storage Average-Case Input Worst-Case Input these are defined similarly Best-Case Time <= Average-Case Time <= Worst-Case Time

Bounding Algorithmic Time (using cases) n 1 n lg(n) n lg 2 (n) 2n2n2n2n n5n5n5n5 lg(n) lg(n)lglg(n) n2n2n2n2 T(n) =  (1) T(n) =  (2 n ) very loose bounds are not very useful! Worst-Case time of T(n) =  (2 n ) tells us that worst-case inputs cause the algorithm to take at most exponential time (i.e. exponential time is sufficient). But, can the algorithm every really take exponential time? (i.e. is exponential time necessary?) If, for arbitrary n, we find a worst-case input that forces the algorithm to use exponential time, then this tightens the lower bound on the worst-case running time. If we can force the lower and upper bounds on the worst-case time to match, then we can say that, for the worst-case running time, T(n) =  (2 n ) (i.e. we’ve found the minimum upper bound, so the bound is tight.) Using “case” we can discuss lower and/or upper bounds on: best-case running time or average-case running time or worst-case running time

Bounding Algorithmic Time (tightening bounds) n 1 n lg(n) n lg 2 (n) 2n2n2n2n n5n5n5n5 lg(n) lg(n)lglg(n) n2n2n2n2 T W (n) =  (2 n ) for example... Here we denote best-case time by T B (n); worst-case time by T W (n) T B (n) =  (1) 1st attempt T B (n) =  (n) 1st attempt 2nd attempt T W (n) =  (n 2 ) T B (n) =  (n) 2nd attempt 1st attempt T W (n) =  (n 2 ) Algorithm Bounds

Master Theorem Master Theorem : Let with a > 1 and b > 1. Then : Case 1: If f(n) = O ( n (log b a) -  ) for some  > o then T ( n ) =  ( n log b a ) Case 2: If f (n) =  (n log b a ) then T ( n ) =  (n log b a * log n ) Case 3: If f ( n ) =  (n log b (a +  ) for some  > o and if a f( n/b) N 0 then T ( n ) =  ( f ( n ) ) Use ratio test to distinguish between cases: f(n)/ f(n)/ n log b a Look for “polynomially larger” dominance.

Sorting Chapters 7-10 Heapsort, Quicksort, LinearTime-Sorting, Medians

Comparison-Based Sorting In algebraic decision tree model, comparison-based sorting of n items requires  (n lg n) time. HeapSort To breaking the lower bound and obtain linear time, forego direct value comparisons and/or make stronger assumptions about input. InsertionSort MergeSort QuickSort  (n lg n)  (n 2 ) BestCaseAverageCaseWorstCase Time: Algorithm:  (n lg n)   (n lg n)  (n lg n)  (n lg n)  (n lg n)  (n lg n)  (n 2 )

Data Structures Chapters Stacks, Queues, LinkedLists, Trees, HashTables, Binary Search Trees, Balanced Trees

Advanced Techniques Chapters Dynamic Programming, Greedy Algorithms

Problem Characteristics Modular Independent pieces Divide-and-Conquer Dynamic Programming Greedy Algorithms ModularOptimization Optimal substructure: optimal solution contains optimal solutions to subproblems Overlapping subproblems ModularOptimization Optimal substructure: optimal solution contains optimal solutions to subproblems Greedy choice property: locally optimal choices lead to global optimum

Graph Algorithms Chapters DFS/BFSTraversals, Topological Sort, MinimumSpanningTrees, Shortest Paths

Traversals: DFS, BFS ä DFS backtracks  visit most recently discovered vertex  LIFO structure  stack data structure ä BFS  vertices close to v are visited before those further away  FIFO structure  queue data structure