1 / 28

Algorithms and Running Time

Algorithms and Running Time Algorithm: Well defined and finite sequence of steps to solve a well defined problem. Eg.,, Sequence of steps to multiply two numbers. Algorithms are meant to solve all instances of problems for which they are designed.

connor
Download Presentation

Algorithms and Running Time

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Algorithms and Running Time Algorithm:Well defined and finite sequence of steps to solve a well defined problem. Eg.,, Sequence of steps to multiply two numbers. Algorithms are meant to solve all instances of problems for which they are designed. Proof of correctness is important for any algorithm. Another aspect is Running Time. Running time is the number of machine instructions it executes when an algorithm is run on a particular instance. Proof of correctness + Running Time = Analysis of Algorithm.

  2. Running Time of an Algorithm Algorithms behavior to any instance of the problem Two rules are necessary Running be given for the worst instance of time. Make running time depend on the size of the instance being solved. Running time is a function. The Running time of an algorithm A is 5N2 + 3n + 72 Where n measures the problem size RT of A becomes O(n2) Big O notation is used to show we are dropping lower order terms. Algorithms whjich run on O(n) are said to be linear time, While that on O(n2)are quadratic. An algotrithm running as polynomial on n is more efficient than that running as 2n.

  3. Classification of Problems Efficient Algorithms Exist Belong to Class P Easy to Solve Problems Efficient Algorithms do not Exist We do not know whether efficient algorithm exist or not. It is undecided i.e. Have not found an efficient algorithm nor do we know if they exist NP Complete problems: If a solution is found one can check if it runs on polynomial time. Easy to Check Problems NP Hard Problems:P and NP problems are Decision Problems. HPP is a Decision Problem.. Some are optimization Problems. The TSA is a optimization problem. The decision version of TSA is NP complete, so the optimization version of TSA is NP hard.

  4. Graphs Described by two sets V the set of nodes or vertices E set of edges A distinct pairs of vertices Graph G is denoted by G = (V,E) vertices by u,v or w. Edges by e or pairs of vertices (u,v) V = {1, 2, 3, 4} E = { (1, 2),(2, 4),(4,2) (4,1)}

  5. Definitions Undirected graphs: Edge is unordered pair of vertices [(u,v) = (v,u)] Directed graph: Edge is an ordered pair of vertices [(u,v) ≠(v,u)] Path is a list of distinct vertices A cycle is a path such that it travels and no edge is repeated. Weighted Graph: We associate a real number with edge. The weight of an edge (u,v) is called it’s cost Distance between u,v. 3, 4} E

  6. Problems with GraphsHamiltonian Path Problem Given a directed or undirected graph find: A cycle in the graph such that every vertex appears exactly once (except first and last vertex). If this is done we have a Hamiltonian Path. Traveling salesman problem: Some cities are modeled as vertices and roads as edges. Traveling salesman are interested in minimizing the distance when visiting the cities.

  7. Hamiltonian PathGiven a graph G, does there exist a closed path through the graph that visits each vertex once and only once? Allowed traversal Allowed traversal Allowed traversal

  8. Forbidden Traversal, since the circled vertices are not visited. The horizontal and vertical mirror images of this traversal are also forbidden (first and second forbidden traversals). Forbidden Traversal, since the circled vertices are not visited. The horizontal and vertical mirror images of this traversals are also forbidden (third and fourth forbidden traversals).

  9. List of resources www.usc.edu/dept/molecular-science Leon Adelman (The man who started it all) www.dna.caltech.edu/~winfree Links to GOOD reviews seemanlab4.chem.nyu.edu DNA nanotechnology How to solve it by Computer R. Dromley, Prentice Hall India.

  10. Computing with DNA The Hamiltonian Path Problem Introduction Watson Crick Pairing Polymerases Ligases Gel Electrophoresis DNA Synthesis

  11. Why DNA Computing for the Hamiltonian Problem Algorithmically it is now Clear that one needs massive Parallelism to solve HPP. DNA Computing Represents Massive Parallelism. It has been Calculated that DNA can Hold 1bit/nm3 while Silicon Based Computers can Hold 1bit/µm3.

  12. DNA Represents Massive Parallelism • For a piece of DNA with a length of 20 bases. 1ml of 0.001 M solution will contain 1017 molecules. • Suppose we make a 1015 strands having different base sequences (100 copies of each sequence in solution) • Introduction 1ml of 0.001 M and among these there are 1014 strands with 1000 copies each. • 104 are sequences which are complements to the earlier strands and 1010 are not. These will hybridize with the original strand in an extremely parallel fashion. • We will find 104 different sequences with 100 copies each

  13. The Algorithm Given a graph with n vertices • Generate a set of random paths through the graph • For each path in the set: • Check whether it starts from start vertex and ends with end vertex; if not remove that path from the set. • Check it that path through exactly n vertices, it not remove that path from the set. • For each vertex, check if the path passes through the vertex. It not remove that path from the set. • If the set is not empty Report a Hamiltonian path • If the set is Empty Report that there is No Hamiltonian Path.

  14. Generate a Pool of Random Paths Synthesize: Complementary DNA City Names (1014 molecules) and DNA flight Numbers (1014 molecules) Take these, put it together with ligase in about 1 second. One has the answer Randomly A--B: GCAGTCGG meets Boston Complementary DNA AGCCTGAC bydesign the A-B sequence ends with TCGG and sequence starts with AGCC. G C A G T C G G A G C C T G A C

  15. Boston* Atlanta - Boston Atlanta* Boston* Boston - Chicago A G C C T G A C G C A G T C G G T G A A C G T C A G C C T G A C G C A G T C G G A C T G G G C T

  16. Atlanta* Boston* Detroit* Atlanta - Boston - Chicago - Detroit T G A A C G T C A G C C T G A C C C G A T A C A G C A G T C G G A C T G G G C T A T G T C C G A

  17. After I Step in the Algorithm Paths Remaining 1. A-B 2. B-A 3. B-D 4. B-C 5. A-D 6. C-D 7. A-B-C 8. A-B-D 9. B-C-D 10. B-A-D 11. A-B-C-D 12. A-B-A-D

  18. After II Step of the Algorithm Paths Left out are: 1. A-D 2. A-B-D 3. A-B-C-D 4. A-B-A-D

  19. After III Step Of the Algorithm Paths Left are: 1. A-B-C-D 2. A-B-A-D

  20. After the Last Step in the Algorithm 1. A-B-C-D

  21. Deterministic & Non-Deterministic Algorithms • Deterministic Algorithms are ones when the Next Step is Fully Defined : Is x a Multiple of y ? • Non Deterministic Algorithms have Steps that Branch out in Several Directions. • When one goes through A-B or A-D one has to Guess as Well as Split. • Computers based on Molecules Mimic both Guessing & Splitting.

  22. The Future of Computing

More Related