1 / 82

233-234

233-234. chazelle@cs.princeton.edu. Sedgewick & Wayne (2004); Chazelle (2005). theory. experimentation. computation. theory. experimentation. 1950. computation. theory. experimentation. 2005. computation. experimentation. theory. 2005. computation. Moore’s Law. No Moore’s Law

nishan
Télécharger la présentation

233-234

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. 233-234 chazelle@cs.princeton.edu Sedgewick & Wayne (2004); Chazelle (2005)

  2. theory experimentation computation

  3. theory experimentation 1950... computation

  4. theory experimentation 2005... computation

  5. experimentation theory 2005 computation Moore’s Law

  6. No Moore’s Law there ! Inverse Moore’s Law?

  7. 1. Power of algorithms

  8. 1. Power of algorithms 2. Duality: data & programs 3. Recursion

  9. A program in C /**/char q='"',*a="*//**/char q='%c',*a=%c%s%c*/};)b(stup;]d[b=]d-472[b)--d(elihw;)q,a,q,q,2+a,b(ftnirps;)b(stup{)(niam;731=d tni;]572[b,",b[275];int d=137;main(){puts(b);sprintf(b,a+2,q,q,a,q);while(d--)b[274-d]=b[d];puts(b);}/*c%s%c%=a*,'c%'=q rahc/**//*"=a*,'"'=q rahc/**/ (By Dan Hoey) palindrome

  10. A program in C char*s="char*s=%c%s%c;void main(){ printf(s,34,s,34);}";void main(){printf(s,34,s,34);}

  11. A program in php <?php $s='<?php $s=%c%s%c; printf($s,39,$s,39); ?>'; printf ($s,39,$s,39); ?>

  12. A program in perl $s="$s=%c%s%c;printf$s,34,$s,34;";printf$s,34,$s,34;

  13. A program in python l='l=%s;print l%%`l`';print l%`l`

  14. A program in Java class S{public static void main(String[]a){String s="class S{ public static void main(String[]a){String s=;char c=34; System.out.println(s.substring(0,52)+c+s+c+s.substring(52));}}"; char c=34; System.out.println(s.substring(0,52)+c+s+c+s.substring(52));}} Output = ? class S{public static void main(String[]a){String s="class S{ public static void main(String[]a){String s=;char c=34; System.out.println(s.substring(0,52)+c+s+c+s.substring(52));}}"; char c=34; System.out.println(s.substring(0,52)+c+s+c+s.substring(52));}}

  15. A Print next statement twice B Why does Schroedinger hate cats? Output = ? Why does Schroedinger hate cats? Why does Schroedinger hate cats? AB  BB

  16. AA  AA Set B=A Print next statement twice Print next statement twice Output = ? Print next statement twice Print next statement twice

  17. duality

  18. Babbage (1820) input data output data program data Rogozhin (1996) : 24 states

  19. Print next statement twice Why does Schroedinger hate cats? Print next statement twice Print next statement twice recursion

  20. duality Print next statement twice Print next statement twice recursion

  21. Self-reproduction = duality + recursion

  22. duality gene - protein dble-stranded recursion http://www.accessexcellence.org/RC/VL/GG/dna_replicating.html

  23. What is the difference between classical math and computer science ?

  24. Jos Leys

  25. Protein Interaction Network Jeong et al

  26. Adjacency matrix

  27. Adjacency lists

  28. Adjacency List Implementation publicclass Graph { privateint V; private Node[] adj; privateint[] degree; privatestaticclass Node { int vertex; Node next; Node(int v, Node next) { this.vertex = v; this.next = next; } } Node next vertex

  29. Adjacency List Implementation publicclass Graph { privateint V; private Node[] adj; privateint[] degree; privatestaticclass Node { int vertex; Node next; Node(int v, Node next) { this.vertex = v; this.next = next; } } public Graph(int V) { this.V = V; adj =new Node[V]; degree =newint[V]; } graph on V verticeswith no edges Node Node Node Node Node Node

  30. Adjacency List Implementation publicint V() { return V; } publicvoid addEdge(int v,int w) { adj[v]=new Node(w, adj[v]); adj[w]=new Node(v, adj[w]); degree[v]++; degree[w]++; } # vertices add w to v's adjacency listadd v to w's adjacency list v x y z w

  31. Adjacency List Implementation publicint V() { return V; } publicvoid addEdge(int v,int w) { adj[v]=new Node(w, adj[v]); adj[w]=new Node(v, adj[w]); degree[v]++; degree[w]++; } # vertices add w to v's adjacency listadd v to w's adjacency list v x y z w

  32. Adjacency List Implementation publicint V() { return V; } publicvoid addEdge(int v,int w) { adj[v]=new Node(w, adj[v]); adj[w]=new Node(v, adj[w]); degree[v]++; degree[w]++; } # vertices add w to v's adjacency listadd v to w's adjacency list v x y z w

  33. Adjacency List Implementation publicint V() { return V; } publicvoid addEdge(int v,int w) { adj[v]=new Node(w, adj[v]); adj[w]=new Node(v, adj[w]); degree[v]++; degree[w]++; } # vertices add w to v's adjacency listadd v to w's adjacency list w v x y z w

  34. Adjacency List Implementation publicint V() { return V; } publicvoid addEdge(int v,int w) { adj[v]=new Node(w, adj[v]); adj[w]=new Node(v, adj[w]); degree[v]++; degree[w]++; } # vertices add w to v's adjacency listadd v to w's adjacency list w v x y z w

  35. Adjacency List Implementation publicint V() { return V; } publicvoid addEdge(int v,int w) { adj[v]=new Node(w, adj[v]); adj[w]=new Node(v, adj[w]); degree[v]++; degree[w]++; } # vertices add w to v's adjacency listadd v to w's adjacency list w v x y z w

  36. Adjacency List Implementation publicint V() { return V; } publicvoid addEdge(int v,int w) { adj[v]=new Node(w, adj[v]); adj[w]=new Node(v, adj[w]); degree[v]++; degree[w]++; } # vertices add w to v's adjacency listadd v to w's adjacency list v w x y z w

  37. Return list of neighbors of v as an array publicint[] neighbors(int v) { int[] neighbors =newint[degree[v]]; int i =0; for(Node x = adj[v]; x !=null; x = x.next) neighbors[i++]= x.vertex; return neighbors; } x x v a b c null d i= 0 i= 1 i= 2 i= 3 d b c a adj neighbors

  38. Hansel & Gretel random walk 1. Birds eat the bread crumbs DFS/BFS 2. They don’t

  39. Diffusion equation

  40. Random walk Diffusion equation Normal distribution 3 views of the same thing

  41. Hansel & Gretel With bread crumbs one can find exit in time proportional to V+E DFS/BFS

  42. Undirected Depth First Search A H I B C G Adjacency Lists A: F C B GB: AC: AD: F EE: G F DF: A E D:G: E A:H: I:I: H: D E F

  43. Undirected Depth First Search A H I B C G D E F newly discovered F visit(A) (A, F) (A, C) (A, B) (A, G) Stack

  44. Undirected Depth First Search A H I A alreadymarked B C G D E visit(F) (F, A) (F, E) (F, D) F visit(A) (A, F) (A, C) (A, B) (A, G) Stack

More Related