Construction and Analysis of Efficient Algorithms Introduction Autumn 2015, Juris Vīksna.

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

CS 336 March 19, 2012 Tandy Warnow.
Introduction to Graph Theory Instructor: Dr. Chaudhary Department of Computer Science Millersville University Reading Assignment Chapter 1.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
CompSci 102 Discrete Math for Computer Science April 19, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
CPE702 Complexity Classes Pruet Boonma Department of Computer Engineering Chiang Mai University Based on Material by Jenny Walter.
String Searching Algorithms Problem Description Given two strings P and T over the same alphabet , determine whether P occurs as a substring in T (or.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 1 (Part 1) Introduction/Overview Tuesday, 9/4/01.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
The Theory of NP-Completeness
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2002 Lecture 1 (Part 1) Introduction/Overview Tuesday, 9/3/02.
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2002 Review Lecture Tuesday, 12/10/02.
Analysis of Algorithms CS 477/677
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 1 (Part 1) Introduction/Overview Wednesday, 9/8/04.
Complexity ©D.Moshkovitz 1 Paths On the Reasonability of Finding Paths in Graphs.
 2004 SDU Introduction to the Theory of Computation My name: 冯好娣 My office: 计算中心 430
GRAPH Learning Outcomes Students should be able to:
Programming & Data Structures
NP-Complete Problems CSC 331: Algorithm Analysis NP-Complete Problems.
EECS 203: It’s the end of the class and I feel fine. Graphs.
CSCE350 Algorithms and Data Structure
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Graphs and DNA sequencing CS 466 Saurabh Sinha. Three problems in graph theory.
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
Approximation Algorithms
CS 200 Algorithms and Data Structures
1 3-COLOURING: Input: Graph G Question: Does there exist a way to 3-colour the vertices of G so that adjacent vertices are different colours? 1.What could.
DP TSP Have some numbering of the vertices We will think of all our tours as beginning and ending at 1 C(S, j) = length of shortest path visiting each.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
1 HEINZ NIXDORF INSTITUTE University of Paderborn Algorithms and Complexity Christian Schindelhauer Search Algorithms Winter Semester 2004/ Oct.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness and course wrap up.
NP-Complete problems.
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler.
Discrete Optimization Lecture 4 – Part 1 M. Pawan Kumar
A new Approach to Fragment Assembly in DNA Sequenceing Fei wu April,24,2006.
1 CSE 326: Data Structures: Graphs Lecture 24: Friday, March 7 th, 2003.
CSC 413/513: Intro to Algorithms
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Review Lecture Tuesday, 12/11/01.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Review: Graph Theory in Bioinformatics Yunkai Liu Assistant Professor Computer Science Department University of South Dakota.
CSE 421 Algorithms Richard Anderson Lecture 28 Survey of NP Complete Problems NP-Complete P.
1 1. Which of these sequences correspond to Hamilton cycles in the graph? (a) (b) (c) (d) (e)
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
1 CSE 326: Data Structures: Graphs Lecture 23: Wednesday, March 5 th, 2003.
34.NP Completeness. Computer Theory Lab. Chapter 34P.2.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Construction and Analysis of Efficient Algorithms
CSC 172 DATA STRUCTURES.
Richard Anderson Lecture 26 NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Eulerian tours Miles Jones MTThF 8:30-9:50am CSE 4140 August 15, 2016.
EECS 203 Lecture 20 More Graphs.
CSC 172 DATA STRUCTURES.
ICS 353: Design and Analysis of Algorithms
Graph Theory.
Graphs Chapter 13.
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 30 NP-Completeness
Richard Anderson Lecture 27 Survey of NP Complete Problems
A Few Sample Reductions
Presentation transcript:

Construction and Analysis of Efficient Algorithms Introduction Autumn 2015, Juris Vīksna

Timetable Regular lecture times: Wednesdays aud. Fridays aud. The lectures at the following dates will be rescheduled: , , (?) – to be yet confirmed) Some other changes are possible (but hopefully, not too many). Replacement lectures most likely will be scheduled starting from the second half of October.

Outline Motivation and some examples Subjects covered in the course Requirements Textbooks Other practical information

Motivation Is there a sufficiently fast algorithm for a given problem? Problem 1b For a given pair of vertices in connected undirected graph find the length of longest non-intersecting path between these vertices. Problem 1a For a given pair of vertices in connected undirected graph find the length of shortest path between these vertices.

Problem 1a For a given pair of vertices in connected undirected graph find the length of shortest path between these vertices.

Problem 1a For a given pair of vertices in connected undirected graph find the length of shortest path between these vertices. There is an algorithm that solves this problem in time less than const · (|V| + |E|)

Problem 1a

d = 0

Problem 1a d = 1

Problem 1a d = 2

Problem 1a d = 3

Problem 1a d = 4

Problem 1a d = 5  OK

Problem 1b For a given pair of vertices in connected undirected graph find the length of longest non-intersecting path between these vertices.

Problem 1b For a given pair of vertices in connected undirected graph find the length of longest non-intersecting path between these vertices. There is not known an algorithm that solves this problem within polynomial time. (And it is widely believed that such algorithm does not exist.)

Problem 1c For a given pair of vertices in connected undirected graph find a non-intersecting path between these vertices consisting of even number of edges.

Problem 2a For a given undirected graph find an Euler cycle (if such exists). Euler cycle is defined as a closed path that contains every edge exactly once.

Eulerian path (cycle) problem For a given graph find a path (cycle) that visits every edge exactly once (or show that such path does not exist).

Problem 2a For a given undirected graph find an Euler cycle (if such exists). Euler cycle is defined as a closed path that contains every edge exactly once. There is an algorithm that solves this problem in time less than const · (|V| + |E|)

Eulerian path (cycle) problem For a given graph find a path (cycle) that visits every edge exactly once (or show that such path does not exist). Eulerian cycle exists if and only if each of graph vertices has even degree. Moreover, there is a simple linear time algorithm for finding Eulerian cycle.

Problem 2b For a given undirected graph find a Hamiltonian cycle (if such exists). Hamiltonian cycle is defined as a closed path that contains every vertex exactly once.

Hamiltonian path (cycle problem) Hamiltonian path (cycle) problem For a given graph find a path (cycle) that visits every vertex exactly once (or show that such path does not exist).

Hamiltonian path (cycle problem) Hamiltonian path (cycle) problem For a given graph find a path (cycle) that visits every vertex exactly once (or show that such path does not exist).

Problem 2b For a given undirected graph find a Hamiltonian cycle (if such exists). Hamiltonian cycle is defined as a closed path that contains every vertex exactly once. There is not known an algorithm that solves this problem within polynomial time. (And it is widely believed that such algorithm does not exist.)

Genome sequence assembly

Sequence assembly problem W.Bains, C.Smith (1988) A novel method for nucleic acid sequence determination. Journal of theoretical biology.Vol. 135:3, Ok, let us assume that we have these hybridizations. How can we reconstruct the initial DNA sequence from them? Affymetrix GeneChip

Sequence assembly problem Ok, let us assume that we have these hybridizations. How can we reconstruct the initial DNA sequence from them?

SBH – Hamiltonian path approach

SBH – Eulerian path approach

An Eulerian path approach to SBH problem PNAS (Proceedings of the National Academy of Sciences), 2001

SBH and de Bruijn graphs (~ 1950 :)

Motivation How to compute the time of computation required for a given algorithm? Does the given algorithm work correctly? Problem 3 Given two strings P and T over the same alphabet , determine whether P occurs as a substring in T.

Problem 3 SimpleMatcher(string P, string T) n  length[T] m  length[P] for s  0 to n  m do if P[1...m] = T[s+1... s+m] then print s Time = const ·n · m

Problem 3 KnuthMorrisPrattMatcher(string P, string T) n  length[T] m  length[P]   PrefixFunction(P) q  0 for i  1 to n do while q > 0 & P[q+1]  T[i] do q   [q] if P[q+1] = T[i] then q  q + 1 if q = m then print i  m q   [q]

Problem 3 PrefixFunction(string P) m  length[P]  [1]  0 k  0 for q  2 to m do while k > 0 & P[k+1]  P[q] do k   [q] if P[q+1] = P[q] then k  k + 1  [q]  k return 

Problem 3 KnuthMorrisPrattMatcher(string P, string T) n  length[T] m  length[P]   PrefixFunction(P) q  0 for i  1 to n do while q > 0 & P[q+1]  T[i] do q   [q] if P[q+1] = T[i] then q  q + 1 if q = m then print i  m q   [q] T(n,m) = T P (m) + n T While (m) T P (m) = const · m T(n,m)  const ·n · m It can be shown that T(n,m) = const · (n + m)

Knuth-Morris-Pratt Algorithm - Idea T = gadjama gramma berida P = gaga gagjamagrammaberida gaga gagjamagrammaberida gaga

Problem 4 Is there an implementation of array of n integers such that: elements can be accessed in constant time, array can be initialised (values of all elements reset to 0) in constant time?

Problem 4 Array M[1...n] Additional variables: Integer Count - number of assignements since the last initialisation Array When[1..n] - array of assignements that have changed the corresponding M elements Array Which[0..n-1] - array of element numbers that have been changed by the assignements 0...n-1

Problem 4 Initialise all elements to 0 Initialise() Count  0 Assign the value v to the i-th element Assign(v,i) M[i]  v if not Modified(i) then When[i]  Count Which[Count]  i Count  Count + 1

Problem 4 Return the i-th element Access(i) if Modified(i) then return M[i] else return 0 Return true, if the i-th element have been modified since the last initialisation Modified(i) if 0  When[i] < Count and Which[When[i]] = i then return true else return false

Subjects covered in the course Models of computation and complexity of algorithms Complexity analysis Data structures Sorting algorithms Algorithms on graphs String searching algorithms Dynamical programming Computational geometry Algorithms for arithmetical problems NP completeness

Requirements Two short-term homeworks Most likely will be given in October-November Strict (or almost) one week deadline 20% each Programming assignment Problem to be announced in second half of October No deadline – must be submitted before the exam 20% Exam 40% To qualify for grade 10 you may be asked to cope with some additional question(s)/problem(s)

Academic honesty You are expected to submit only your own work! Sanctions: Receiving a zero on the assignment (in no circumstances a resubmission will be allowed) No admission to the exam and no grade for the course

Textbooks Thomas H.Cormen Charles E.Leiserson Ronald L.Rivest Clifford Stein Introduction to Algorithms The MIT Press, 2009 (3 rd ed, 1 st ed 1990)

Textbooks Harry R.Lewis Larry Denenberg Data Structures and their Algorithms Harper Collins Publishers, 1991

Textbooks Steven S.Skiena The Algorithm Design Manual Springer Verlag, 2008 (2 nd ed, 1 st ed 1997)

Textbooks Alfred V.Aho, John E.Hopcroft, Jeffrey D.Ullman The Design and Analysis of Computer Algorithms Addison-Wesley Publishing Company, 1976

Textbooks David Harel, Algorithmics: the spirit of computing Addison-Wesley Publishing Company, 2004 (3 rd ed)

Textbooks Dan Gusfield Algorithms on Strings Trees and Sequences Cambridge University Press, 1997

Textbooks Michael R. Garey, David S. Johnson Computers and Intractability – A Guide to the Theory of NP-Completeness W. H. Freedman and Company, 1979

Web page It is expected to contain: short summaries of lectures announcements power point presentations homework and programming assignment problems frequently asked questions (???) your grades other useful information Course information available also at

Contact information Juris Vīksna Room 421, Rainis boulevard 29 phone: