Intro to Computer Algorithms Lecture 21 Phillip G. Bradford Computer Science University of Alabama.

Slides:



Advertisements
Similar presentations
NP-Complete Problems CIT 596, Spring Problems that Cross the Line What if a problem has: o An exponential upper bound o A polynomial lower bound.
Advertisements

CS138A Single Source Shortest Paths Peter Schröder.
NP-Completeness Lecture for CS 302. Traveling Salesperson Problem You have to visit n cities You want to make the shortest trip How could you do this?
CPE702 Complexity Classes Pruet Boonma Department of Computer Engineering Chiang Mai University Based on Material by Jenny Walter.
CS38 Introduction to Algorithms Lecture 5 April 15, 2014.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 1 (Part 3) Tuesday, 9/4/01 Greedy Algorithms.
1.1 Data Structure and Algorithm Lecture 11 Application of BFS  Shortest Path Topics Reference: Introduction to Algorithm by Cormen Chapter 25: Single-Source.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
NP-Complete Problems Problems in Computer Science are classified into
Graph Algorithms: Shortest Path We are given a weighted, directed graph G = (V, E), with weight function w: E R mapping.
Analysis of Algorithms CS 477/677
Chapter 11: Limitations of Algorithmic Power
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2002 Lecture 1 (Part 3) Tuesday, 1/29/02 Design Patterns for Optimization.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
CPSC 411, Fall 2008: Set 4 1 CPSC 411 Design and Analysis of Algorithms Set 4: Greedy Algorithms Prof. Jennifer Welch Fall 2008.
Theory of Computing Lecture 7 MAS 714 Hartmut Klauck.
Dijkstra's algorithm.
Shortest Path Algorithms. Kruskal’s Algorithm We construct a set of edges A satisfying the following invariant:  A is a subset of some MST We start with.
Design and Analysis of Computer Algorithm September 10, Design and Analysis of Computer Algorithm Lecture 5-2 Pradondet Nilagupta Department of Computer.
Programming & Data Structures
Algorithms: Design and Analysis Summer School 2013 at VIASM: Random Structures and Algorithms Lecture 3: Greedy algorithms Phan Th ị Hà D ươ ng 1.
Chapter 11 Limitations of Algorithm Power. Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples:
CSCE350 Algorithms and Data Structure
A. Levitin “Introduction to the Design & Analysis of Algorithms,” 3rd ed., Ch. 11 ©2012 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.
TECH Computer Science NP-Complete Problems Problems  Abstract Problems  Decision Problem, Optimal value, Optimal solution  Encodings  //Data Structure.
CSC 413/513: Intro to Algorithms NP Completeness.
CSE 3813 Introduction to Formal Languages and Automata Chapter 14 An Introduction to Computational Complexity These class notes are based on material from.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
The single-source shortest path problem (SSSP) input: a graph G = (V, E) with edge weights, and a specific source node s. goal: find a minimum weight (shortest)
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
CSE373: Data Structures & Algorithms Lecture 22: The P vs. NP question, NP-Completeness Lauren Milne Summer 2015.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
CSCE350 Algorithms and Data Structure Lecture 19 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CSCI 2670 Introduction to Theory of Computing November 17, 2005.
CS 461 – Nov. 18 Section 7.1 Overview of complexity issues –“Can quickly decide” vs. “Can quickly verify” Measuring complexity Dividing decidable languages.
CSE 340: Review (at last!) Measuring The Complexity Complexity is a function of the size of the input O() Ω() Θ() Complexity Analysis “same order” Order.
NPC.
Young CS 331 D&A of Algo. NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and.
Optimization/Decision Problems Optimization Problems – An optimization problem is one which asks, “What is the optimal solution to problem X?” – Examples:
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
1 1. Which of these sequences correspond to Hamilton cycles in the graph? (a) (b) (c) (d) (e)
CS38 Introduction to Algorithms Lecture 3 April 8, 2014.
1 P and NP. 2 Introduction The Traveling Salesperson problem and thousands of other problems are equally hard in the sense that if we had an efficient.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
Algorithm Design and Analysis June 11, Algorithm Design and Analysis Pradondet Nilagupta Department of Computer Engineering This lecture note.
Intro to Computer Algorithms Lecture 15 Phillip G. Bradford Computer Science University of Alabama.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
The NP class. NP-completeness
NP-Complete Problems.
Chapter 10 NP-Complete Problems.
Hard Problems Introduction to NP
CSCI 2670 Introduction to Theory of Computing
Analysis and design of algorithm
ICS 353: Design and Analysis of Algorithms
Computational Complexity
Lecture 11 Topics Application of BFS Shortest Path
Chapter 11 Limitations of Algorithm Power
Chapter 34: NP-Completeness
CSC 380: Design and Analysis of Algorithms
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
CSE 589 Applied Algorithms Spring 1999
CSC 380: Design and Analysis of Algorithms
Algorithms CSCI 235, Spring 2019 Lecture 36 P vs
Presentation transcript:

Intro to Computer Algorithms Lecture 21 Phillip G. Bradford Computer Science University of Alabama

Announcements Advisory Board’s Industrial Talk Series 2-Dec: Mike Thomas, CIO, Gulf States Paper

Computer Security Research Group Meets every Friday from 11:00 to 12:00 In 112 Houser Computer Security, etc. me to be on the mailing list!

CS Story Time Prof. Jones’ research group See

Next Midterm Tuesday before Thanksgiving ! 25-November

Outline Dijkstra’s Algorithm The Single-source shortest path challenge Start talking about Huffman trees Introduction to Complexity Theory

Dijkstra’s Algorithm in Detail Recall the intuition Sort of like Prim’s Algorithm Fringe and shortest paths Main Invariant: once an element is absorbed from the fringe, then we have its shortest path See “S” in the next algorithm

Dijkstra’s Algorithm Init-Single-Source(G,w,s) S  emptyset; Q  V[G] While Q not empty do u  extractMin(Q) S  S union { u } For all v in adj[u] do Relax(u,v,w)

Dijkstra’s Algorithm Init-Single-Source(G,w,s) Set all vertex distance estimates to Infinity Relax(u,v,w): If d u +w(u,v) < d v then d v  d u +w(u,v) Decrease(Q,v,d v )

The Cost of Dijkstra’s Algorithm Example at the board We relax each edge once The decrease-key operation and the extractmin operations cost O(log |V|) Therefore, Dijkstra’s algorithm costs O(|E| log |V|) Where might there be room for improvement?

Huffman Trees Fixed length encodings Prefix free Prefix Trees Left edges labeled with 0 Right edges labeled with 1 How can we make sure short encodings represent common letters?

Huffman’s Algorithm Greedy method starting with one-node trees Merge least-weight trees, label the root with the sub tree sums Example in lecture!

Algorithm Design Paradigms vs. Apparently Very Hard Problems Lower bounds for problems Upper bounds for algorithms How about problems that just `seem’ hard?

Church-Turing Thesis What is our model of computation? How can we prove facts about computation using this model? Turing Machine Equivalent, within polynomial time, to all other `reasonable’ proposed computation

Determinism and Non- Determinism Deterministic algorithms Classical idea from Church-Turing Every action is directly from a consequence Non-Deterministic algorithms Guessing actions Verifying guessed solution deterministically

NP and P P is all decision problems solvable in deterministic polynomial time NP is all decision problems solvable in Non-deterministic polynomial time Certainly, P subset NP What about the other way?

P vs. NP is a big deal in all of Engineering and Science Clay Institute $1 million to solve this challenge

Cook-Levin Theorem CNF-SAT (x 1 or NOT(x 2 ) or x 3 ) AND (NOT(x 1 ) or x 2 ) AND… Truth assignments How hard CNF-SAT be? All (decision) problems in NP are polynomially reducible to CNF-SAT

Tractable and Intractable O(2 n ) intractable for even modest n assuming the Church-Turing thesis O(n 100 ) is `tractable’ given large n Seems strange… Say n=10 6 or 1 million Then (10 6 ) 100 = is certainly not computable in any reasonable sense!

Hypothetical Relationships P NP-Comp. NP