Computers and Algorithms - What can they do and what can they not?


Published on

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Computers and Algorithms - What can they do and what can they not?

  2. 2. <ul><li>Concept of an ‘algorithm’. </li></ul><ul><li>Algorithms studied in and by themselves. </li></ul><ul><li>Two characteristics required of an algorithm. </li></ul><ul><li>Inherent limitations to what is computable. </li></ul><ul><li>Many problems can never have solutions. </li></ul><ul><li>‘ Halting Problem’ a classic that has no solution. </li></ul><ul><li>Some problems only theoretically solvable. </li></ul><ul><li>Applications of such intractable problems. </li></ul><ul><li>PREVIOUS EXPOSURE TO COMPUTERS NOT NEEDED </li></ul>
  3. 3. <ul><li>‘ Algorithm’ a precise specification of the method or procedure to be followed for solving a problem. </li></ul><ul><li>algorithm recipe </li></ul><ul><li>input ingredients </li></ul><ul><li>prog. language natural language </li></ul><ul><li>computer cook / chef </li></ul><ul><li>Algorithm, an abstract entity: machine and language independent. </li></ul><ul><li>For a procedure to be an algorithm, two reqr.: </li></ul><ul><ul><li>Applicable to every instance of the problem. </li></ul></ul><ul><ul><li>Terminate/halt and yield an answer in finite time. </li></ul></ul>
  4. 4. <ul><li>Prime: An integer that is divisible only by 1 and by itself. </li></ul><ul><li>Algorithm for checking if number (N >3) is prime: </li></ul><ul><ul><li>Set k =2. </li></ul></ul><ul><ul><li>2. Divide N by k. </li></ul></ul><ul><ul><li>If remainder = 0 then step 7. </li></ul></ul><ul><ul><li>4. Increment k. </li></ul></ul><ul><ul><li>5. If k<>N then step 2. </li></ul></ul><ul><ul><li>6. Answer ‘Yes’ and stop. </li></ul></ul><ul><ul><li>7. Answer ‘No’ and stop. </li></ul></ul><ul><li>Important : Applicable for every N > 3. </li></ul>
  5. 5. <ul><li>Goldbach Conjecture : Every even integer greater than 2 can be expressed as the sum of two primes. </li></ul><ul><li>Given an integer 2N, number of attempts to find the primes is limited to the value of N. Hence termination of procedure guaranteed . </li></ul><ul><li>Variation : Every even integer can be expressed as the difference of 2 primes. </li></ul><ul><li>Since number of primes is infinite, no guarantee of termination! </li></ul><ul><li>Moral : Not all procedures are algorithms. </li></ul>
  6. 6. <ul><li>The ‘Halting Problem’ has no algorithm. </li></ul>A P D ‘ Yes’ if P halts on D ‘ No’ if P loops on D A1 P D A1 loops if P halts on D A1 halts if P loops on D
  7. 7. B A1 C loops on P if P halts on D C halts on P if P loops on D C P P P <ul><li>Compare with: ‘This statement is false’. </li></ul><ul><li>The ‘Halting Problem’ is not decidable. </li></ul><ul><li>The ‘Equivalence Problem’ is not decidable. </li></ul>
  8. 8. <ul><li>While many problems have no algorithms and are therefore unsolvable, many others are only ‘theoretically’ solvable. </li></ul>22 43 35
  9. 9. <ul><li>N cities and ‘cost’ associated with travel between two cities. </li></ul><ul><li>Problem : Touch every city exactly once so that the total cost is minimum possible. </li></ul><ul><li>Time required to solve the problem increases dramatically as N increases. </li></ul><ul><li>For N = 80, for example, the time required is of the order of 500 billion years ! </li></ul><ul><li>Need therefore for study of ‘time complexity’ of algorithms. </li></ul>
  10. 10. <ul><li>10 5 22 7 8 15 32 2 : n-1 comparisons </li></ul><ul><li>2 5 22 7 8 15 32 10 : n-2 comparisons </li></ul><ul><li>2 5 22 7 8 15 32 10 : n-3 comparisons </li></ul><ul><li>. </li></ul><ul><li>. </li></ul><ul><li>Hence total number of comparisons is n(n-1)/2 or of the order of n 2 or O(n 2 ). </li></ul><ul><li>Important : Time complexity estimated without regard to language in which algorithm written, or machine on which executed! </li></ul>
  11. 11. <ul><li>Sorting algorithm of O(n 2 ) establishes upper bound on the sorting problem. </li></ul><ul><li>Inherent complexity of sorting no worse than O(n 2 ). </li></ul><ul><li>Finding lower bound for an algorithmic problem is not trivial. </li></ul><ul><li>Lower bound  no better than </li></ul><ul><li>Inherent complexity of sorting problem no better than O(n log n). </li></ul><ul><li>Concept of ‘algorithmic gap’. </li></ul>
  12. 12. <ul><li>Massive algorithmic gaps may exist for many problems. </li></ul><ul><li>Polynomial time complexity problems are FEASIBLE / TRACTABLE . </li></ul><ul><li>Traveling Salesman Algorithm has time complexity of O(N!), but has important applications in </li></ul><ul><ul><li>Telephone networks </li></ul></ul><ul><ul><li>IC design and layout </li></ul></ul><ul><ul><li>Programming of a robot arm </li></ul></ul><ul><ul><li>Construction scheduling etc </li></ul></ul><ul><li>‘ Time Table Problem’ subject to given constraints also infeasible. </li></ul>
  13. 13. <ul><li>Limitations due to infeasibility can be turned into a virtue! </li></ul><ul><li>Cryptography is one such important instance. </li></ul><ul><li>Conventional private cryptosystems: </li></ul><ul><li>H = E(M) : D(H) = M </li></ul><ul><li>Disadvantages of this system: </li></ul><ul><ul><li>Key transmission on a secure channel. </li></ul></ul><ul><ul><li>Authentication difficult. </li></ul></ul><ul><li>Lock and key analogy. </li></ul><ul><li>Public key cryptography to the rescue! </li></ul>
  14. 14. <ul><li>Public key cryptography relies on the crucial fact that ‘Some problems are infeasible (today)’. </li></ul><ul><li>Padlock analogy: encryption function E is public, decryption function D is private. </li></ul><ul><li>Functions E and D are mutual inverses: </li></ul><ul><li>D(E(M)) = M and E(D(M)) = M </li></ul><ul><li>Moreover and more importantly, (E, D) a trap-door function pair : given E, finding out D is infeasible! </li></ul><ul><li>However, applying both D and E feasible! </li></ul><ul><li>Crucially dependent on the fact that: </li></ul><ul><ul><li>Testing for prime number is feasible. </li></ul></ul><ul><ul><li>Factorization (a closely related problem) is not! </li></ul></ul>
  15. 15. M =‘attack at dawn’ ‘ attack at dawn’= M H = Da(M) S=Eb(H) Db(S) = H Ea(H) = M transmission channel Sender A Receiver B
  16. 16. <ul><li>Advantages of Public Key Cryptography: </li></ul><ul><li>No prior arrangement or passing of keys. </li></ul><ul><li>Signed message transmission. </li></ul><ul><li>Later denial by sender not possible. </li></ul><ul><li>Faking of message not possible. </li></ul><ul><li>Message modification by receiver not possible. </li></ul><ul><li>And all of this because: SOME PROBLEMS ARE INFEASIBLE. </li></ul>
  17. 17. <ul><li>Concept of ‘algorithm’ and its two characteristics. </li></ul><ul><li>Study of time complexity of algorithms. </li></ul><ul><li>Infeasible problems and an application that depends on problem infeasibility! </li></ul><ul><li>Incomputability or unsolvability. </li></ul><ul><li>Undecidability of the ‘Halting Problem’. </li></ul><ul><li>No matter how ‘powerful’ the computer, many problems inherently unsolvable. </li></ul><ul><li>:Thank You: </li></ul>
  18. 18. <ul><li>This talk is based largely on the material available in 'Algorithmics: The Spirit of Computing' by David Harel; Add. Wesley Press. </li></ul>