CS 483. Jana Kosecka CS Dept Eng. Building

Similar documents
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

Design and Analysis of Algorithms. Comp 271. Mordecai Golin. Department of Computer Science, HKUST

CSE 417 Practical Algorithms. (a.k.a. Algorithms & Computational Complexity)

CS 4800: Algorithms & Data. Lecture 1 January 10, 2017

Lecture 1 (Part 1) Introduction/Overview

Virtual University of Pakistan

CS/COE 1501 cs.pitt.edu/~bill/1501/ Introduction

Computer Science 210 Data Structures Siena College Fall Topic Notes: Complexity and Asymptotic Analysis

Advanced Algorithms and Data Structures

Algorithms and Data Structures, or

Data Structures and Algorithms 1

CS 4349 Lecture August 21st, 2017

Scientific Computing. Algorithm Analysis

CS/COE 1501

San José State University Computer Science Department CS49J, Section 3, Programming in Java, Fall 2015

COMP Data Structures

COMP Data Structures

Table of Contents. Course Minutiae. Course Overview Algorithm Design Strategies Algorithm Correctness Asymptotic Analysis 2 / 32

Introduction to Algorithms 6.046J/18.401J

COMP251: Algorithms and Data Structures. Jérôme Waldispühl School of Computer Science McGill University

EECS 3101: Introduction to the Design and Analysis of Algorithms Instructor: Suprakash Datta (datta[at]cse.yorku.ca) ext 77875

Advanced Algorithms and Data Structures

Data Structures and Algorithms

Theory and Algorithms Introduction: insertion sort, merge sort

Introduction to Algorithms 6.046J/18.401J/SMA5503

CS 132 Exam #1 - Study Suggestions

Part A: Course Outline

THE TEN COMANDMENTS OF ALGEBRA

CSCE 321/3201 Analysis and Design of Algorithms. Prof. Amr Goneid. Fall 2016

Introduction to Computer Science

COMP Analysis of Algorithms & Data Structures

Searching, Sorting. Arizona State University 1

CS2013 Course Syllabus Spring 2018 Lecture: Mon/Wed 2:00 P.M. 2:50 P.M. SH C259 Lab: Mon/Wed 2:50 P.M. 4:00 P.M. SH C259

CS2 Algorithms and Data Structures Note 1

San José State University Department of Computer Science CS166, Information Security, Section 1, Fall, 2018

San José State University Department of Computer Science CS-144, Advanced C++ Programming, Section 1, Spring 2018

CMPE 180A Data Structures and Algorithms in C++

Algorithms and Data Structures (INF1) Lecture 15/15 Hua Lu

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 25: Review and Open Problems

CSE : PARALLEL SOFTWARE TOOLS

CS302 Topic: Algorithm Analysis. Thursday, Sept. 22, 2005

Design and Analysis of Algorithms

Algorithm Analysis and Design

CS1 Lecture 30 Apr. 2, 2018

Computer Networks. Syllabus Ver Instructor: Ass.Prof. Yuriy Shamshin. ISMA University Riga, Latvia

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

Computer Algorithms CISC4080 CIS, Fordham Univ. Acknowledgement. Outline. Instructor: X. Zhang Lecture 1

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Calculus (Math 1A) Lecture 1

DATA STRUCTURES AND ALGORITHMS

CSE548, AMS542: Analysis of Algorithms, Fall 2012 Date: October 16. In-Class Midterm. ( 11:35 AM 12:50 PM : 75 Minutes )

Project 1. due date Sunday July 8, 2018, 12:00 noon

Design and Analysis of Algorithms

Algorithms and Data Structures

CSE373: Data Structures & Algorithms Lecture 28: Final review and class wrap-up. Nicki Dell Spring 2014

Complexity. Alexandra Silva.

Lecture 4. Defining Functions

CS 361 Data Structures & Algs Lecture 15. Prof. Tom Hayes University of New Mexico

3/7/2018. CS 580: Algorithm Design and Analysis. 8.1 Polynomial-Time Reductions. Chapter 8. NP and Computational Intractability

CS 580: Algorithm Design and Analysis

San José State University Department of Computer Science CS-174, Server-side Web Programming, Section 2, Spring 2018

Practice Problems for the Final

Design and Analysis of Algorithms

CS61A Lecture 7 Complexity and Orders of Growth. Jon Kotker and Tom Magrino UC Berkeley EECS June 27, 2012

Lecture 1: Examples, connectedness, paths and cycles

Chapter 4. Divide-and-Conquer. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Overview. CSE 101: Design and Analysis of Algorithms Lecture 1

WELCOME! (download slides and.py files and follow along!) LECTURE 1

COT 6936: Topics in Algorithms! Giri Narasimhan. ECS 254A / EC 2443; Phone: x3748

Data Structures and Algorithms

Chapter 3. Graphs CLRS Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

CSC 325 Algorithms & Advanced Data Structures

COMPUTER SCIENCE IN THE NEWS. CS61A Lecture 7 Complexity and Orders of Growth TODAY PROBLEM SOLVING: ALGORITHMS COMPARISON OF ALGORITHMS 7/10/2012

COT 5407: Introduction to Algorithms. Giri Narasimhan. ECS 254A; Phone: x3748

School of Computing and Information Sciences. Course Title: Data Structures Date: 3/30/2010 Course Number: COP 3530 Number of Credits: 3

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

CS 445: Data Structures Final Examination: Study Guide

CS313T ADVANCED PROGRAMMING LANGUAGE

Data Structures and Algorithm Analysis (CSC317) Introduction

AP COMPUTER SCIENCE A: SYLLABUS

COE428 Lecture Notes Week 1 (Week of January 9, 2017)

Lecture 3, Review of Algorithms. What is Algorithm?

A loose end: binary search

Complexity. Alexandra Silva.

Class Note #02. [Overall Information] [During the Lecture]

CMPT 126: Introduction to Computing Science and Programming Fall 2007, Harbour Centre

ECE250: Algorithms and Data Structures Final Review Course

Welcome to MCS 275. Course Content Prerequisites & Expectations. Scripting in Python from OOP to LAMP example: Factorization in Primes

Lecture 4. Defining Functions

Algorithms and Data Structures. Algorithms and Data Structures. Algorithms and Data Structures. Algorithms and Data Structures

Welcome to CSE 326: Data Structures & Algorithms

Introduction to Parallel Computing

San José State University Department of Computer Science CS049J, Programming in Java, Section 2, Fall, 2016

Midterm CSE 21 Spring 2012

Single Source Shortest Path: The Bellman-Ford Algorithm. Slides based on Kevin Wayne / Pearson-Addison Wesley

Programming II (CS300)

CS2223: Algorithms D- Term, Homework I. Teams: To be done individually. Due date: 03/27/2015 (1:50 PM) Submission: Electronic submission only

10. EXTENDING TRACTABILITY

CSE 332 Autumn 2013: Midterm Exam (closed book, closed notes, no calculators)

CS 373: Combinatorial Algorithms, Spring 1999

Transcription:

CS 483 Jana Kosecka CS Dept. 4444 Eng. Building kosecka@gmu.edu

Course Info Course webpage: from the syllabus on http://cs.gmu.edu/courses/ Information you will find course syllabus, time table office hours pdf copies of the lectures handouts, practice problems

Prerequisites Data structures and algorithms (CS 310) Formal methods and models (CS 330) Calculus (MATH 113, 114, 213) Discrete math (MATH 125) Ability to program in a high-level language that supports recursion

Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 4

Grades Short Quizes every 2 weeks (40%) Practice Problems Midterm Exam 30% Final Exam 30% Make-up tests will NOT be given for missed examinations

Other Important Info Email make sure your gmu mail is activated send only from your gmu account; mails might be filtered if you send from other accounts when you send emails, put [CS483] in your subject header

Goal of the Course Design efficient algorithms and analyze their complexity Analysis: what are the computational resources needed? time, storage, #processors, programs, communications What is an algorithm: Recipe to solve a problem Clear specification of the problem What is the input? What is the output? How long does it take, under particular circumstances? What are the memory requirements? (space)

Examples of algorithms sorting algorithms everywhere routing, graph theoretic algorithms number theoretic algorithms, cryptography web search triangulation- graphics, optimization problems string matching (computational biology), cryptography security

Shortest Paths Given a graph, find the shortest path in the graph connecting the start and goal vertices. What is a graph? How do you represent the graph? How do you formalize the problem? How do you solve the problem?

Shortest Paths What is the most naive way to solve the shortest path problem? EX: a graph with only 4 nodes How much time does your method take? Can we do better? How do we know our method is optimal? (i.e., no other methods can be more efficient.)

Shortest Paths Given a graph, find the shortest path in the graph that visits each vertex exactly once. How do you formalize the problem? How do you solve the problem? How much time does your method take? Can we do better?

Hard Problems We are able to solve many problems, but there are many other problems that we cannot solve efficiently we can solve the shortest path between two vertices efficiently but we cannot efficiently solve the shortest path problem that requires that path to visit each vertex exactly once

Course Topics Week 1: Algorithm Analysis (growth of functions) Week 2: Analysis Week 3: Graph Algorithms Week 4: Greedy Algorithms Week 5: Divide and Conquer Week 6: Dynamic Programming Week 7: Max Flow Week 8: Approximation Algorithms Week 9: Local Search Week 10: Randomized Algorithms Week 11: NP completeness See updates on the course webpage

Warning & Suggestions Please don t take this class if you You do not have the mathematics and/or CS prerequisites You are not able to make arrangements to come to GMU to take the exams on-site You are working full-time and taking another graduate level computer science class You are not able to spend a minimum of 9~12 hours a week outside of class reading the material and doing practice problem sets

Sorting Problem: Sort real numbers in nondecreasing order Input: Output: Why do we need to sort?

Sorting Sorting is important, so there are many sorting algorithms Selection sort Insertion sort Library sort Shell sort Gnome sort Bubble sort Comb sort Binary tree sort Topological sort

Sorting Algorithms in general We will be concerned with efficiency Memory requirements Independent of the computer speed How to design algorithms What is the easiest (or most naive) way to do sorting? EX: sort 3,1,2,4 how efficient is your method? We will look at two sorting algorithms

Insertion Sort If you ever sorted a deck of cards, you have done insertion sort If you don t remember, this is how you sort the cards: you sort the card one by one assuming the first i cards are sorted, now sort the (i+1)-th card EX: 4, 6, 1, 3, 7, 9, 2

Insertion Sort EX: 4, 6, 1, 3, 7, 9, 2

Analyze Insertion Sort Is it correct? How efficient/slow is insertion sort? Characterize running time as a function of input size Compute running time of each statement Sum up the running times

Insertion Sort Cost times c 1 n c 2 n-1 c 4 n-1 c 5 c 6 c 7 nx t j nx j=2 (t j 1) nx (t j 1) j=2 j=2 c 8 n-1 EX: 4, 6, 1, 3, 7, 9, 2 Running time constant amount of time is needed to execute each line, we need to count how many times each line will be executed t j - number of times test in line 5 is executed for that value of j For while and for loop the test is usually executed one more time then the loop body

Insertion Sort Analysis n T (n) =c 1 n + c 2 (n 1) + c 3 (n 1) + c 4 t j + c 5 Best case j=2 n (t j 1) + c 6 n j=2 j=2 (t j 1) + c 7 n (n-1) T (n) =c 1 n + c 2 (n 1) + c 3 (n 1) + c 4 (n 1) + c 7 (n 1) Worst case input in the reverse order T (n) =c 1 n + c 2 (n 1) + c 3 (n 1) + c 4 n j=2 j + c 5 n (j 1) + c 6 n j=2 j=2 (j 1) + c 7 n (n-1) T (n) =an 2 + bn + c

Algorithm analysis Running time depends on the size of the input (10 vs 100000) On the type of the input (sorted, partially sorted) Independent Speed of the computer Kinds of analysis: Worst Case analysis max time on any input Average Case T(n) = average time over all inputs of size n assuming some distribution

Algorithm analysis Use pseudocode description in the language independent way use proper indentation Analysis of the running time of the algorithm: How much time does it take? (Cost per operation * number of operations) Choosing the basic operations and how long they take Too detailed, constant factors do not matter Machine independent time, Assymptotic Analysis We would like to ignore machine dependent constants characterize the running time T(n) as n