188
Programming`s Greatest Hits of the 60s and 70s Michelle Brush Engineering Director, Cerner Corporation Chapter Leader, Kansas City Girl Develop It Conference Organizer, Midwest.io

Programming's Greatest Hits of the 60s and 70s

Embed Size (px)

Citation preview

Page 1: Programming's Greatest Hits of the 60s and 70s

Programming`s Greatest Hits of the

60s and 70s

Michelle Brush Engineering Director, Cerner Corporation

Chapter Leader, Kansas City Girl Develop It Conference Organizer, Midwest.io

Page 2: Programming's Greatest Hits of the 60s and 70s

Where  Are  We?

(41.911582,  -­‐87.634803)

Page 3: Programming's Greatest Hits of the 60s and 70s

Where  Are  We?

(41.911582,  -­‐87.634803)

Latitude:  Y  value

Page 4: Programming's Greatest Hits of the 60s and 70s

Where  Are  We?

(41.911582,  -­‐87.634803)

Latitude:  Y  value Longitude:  X  value

Page 5: Programming's Greatest Hits of the 60s and 70s

Assuming  we  have  a  data  store  of  the  locations  of  all  

bars  in  the  world…

https://www.flickr.com/photos/shutterrunner/4334879403/“Today. The Green Door Tavern.” Shutter Runner CC BY 2.0

Page 6: Programming's Greatest Hits of the 60s and 70s

Let’s find a fun place

nearbyto have a beer.

Page 7: Programming's Greatest Hits of the 60s and 70s

Interview Question:

Write  an  API  to  support  searching  for  the  nearest  bars.  

     

How would you do it?

Page 8: Programming's Greatest Hits of the 60s and 70s

Right  Answer

Google  Places  API

Page 9: Programming's Greatest Hits of the 60s and 70s

Sometimes our job is to find ways to not write code.

Page 10: Programming's Greatest Hits of the 60s and 70s

Let’s rephrase the question.

Page 11: Programming's Greatest Hits of the 60s and 70s

Interview Question:

Write  an  API  to  support  searching  for  the  nearest  bars                            

from  scratch.      

How would you do it?

Page 12: Programming's Greatest Hits of the 60s and 70s
Page 13: Programming's Greatest Hits of the 60s and 70s
Page 14: Programming's Greatest Hits of the 60s and 70s

Binary Search2 4 7 9 11 13 34 37 92 1050 1 2 3 4 5 6 7 8 9

?

?

?Found It!

Page 15: Programming's Greatest Hits of the 60s and 70s

Everyone  used  to  know  binary  search.      

They  just  didn’t  know  what  it  was  called.

(cc)  http://www.recyclethis.co.uk(and picked inefficient pivot points)

Page 16: Programming's Greatest Hits of the 60s and 70s

SOME SORTING REQUIRED.

INSERT SORT ALGORITHM NOW.

Page 17: Programming's Greatest Hits of the 60s and 70s

Sort by X, then Y!

Page 18: Programming's Greatest Hits of the 60s and 70s

Well, that breaks.

Page 19: Programming's Greatest Hits of the 60s and 70s

Which is closer?

United  Lily  Growers  

in  Smith  River  California  

~1800  miles

The  Green  Door  Tavern  

not  that  far  in  Chicago  

1.26  miles

or  

Page 20: Programming's Greatest Hits of the 60s and 70s

X gets preferential treatment over Y.

It doesn’t deserve it.

Page 21: Programming's Greatest Hits of the 60s and 70s

How about brute force?

Page 22: Programming's Greatest Hits of the 60s and 70s

1. Iterate  over  every  bar.  2. Calculate  the  distance.  3. Sort  by  the  distance.

 

Page 23: Programming's Greatest Hits of the 60s and 70s

1630 bars in Chicago alone.

Page 24: Programming's Greatest Hits of the 60s and 70s

Is there a right answer?

Page 25: Programming's Greatest Hits of the 60s and 70s

Was I just a mean interviewer?

Page 26: Programming's Greatest Hits of the 60s and 70s

Some people got it right.

Page 27: Programming's Greatest Hits of the 60s and 70s

Physics Majors

Page 28: Programming's Greatest Hits of the 60s and 70s

In particular…

Physics  majors  that  care  about  particle  collisions.

Page 29: Programming's Greatest Hits of the 60s and 70s

Divide  &  Conquer  the  Space

Page 30: Programming's Greatest Hits of the 60s and 70s

Divide  &  Conquer  the  Space

Page 31: Programming's Greatest Hits of the 60s and 70s

Divide  &  Conquer  the  Space

Page 32: Programming's Greatest Hits of the 60s and 70s

Divide  &  Conquer  the  Space

Page 33: Programming's Greatest Hits of the 60s and 70s

Rules

Quadrants  are  not  always  equal  in  space.  

They  can  be  equal  in  capacity.          

Capacity  =  Number  of  Objects

Page 34: Programming's Greatest Hits of the 60s and 70s

Center  Point

(X,  Y)

Page 35: Programming's Greatest Hits of the 60s and 70s

Or  Bounding  Box

(  X1,  Y1  )

(  X2,  Y2  )

Page 36: Programming's Greatest Hits of the 60s and 70s

Create  a  Tree  of  Nested  Quadrants

Page 37: Programming's Greatest Hits of the 60s and 70s

Follow  the  Rectangles  Down

Page 38: Programming's Greatest Hits of the 60s and 70s

Follow  the  Rectangles  Down

Page 39: Programming's Greatest Hits of the 60s and 70s

Follow  the  Rectangles  Down

Page 40: Programming's Greatest Hits of the 60s and 70s

Follow  the  Rectangles  Down

Page 41: Programming's Greatest Hits of the 60s and 70s

1974

Jon L. Bentley & Raphael Finkel

Quad-Trees

Page 42: Programming's Greatest Hits of the 60s and 70s

1974

Jon L. Bentley (includes buggy implementation of binary search)

Page 43: Programming's Greatest Hits of the 60s and 70s

Quad-tree is a very good answer.

It can be generalized to more dimensions.

Page 44: Programming's Greatest Hits of the 60s and 70s

Octrees

WhiteTimberwolf 2010, Schematic drawing of an octree, a data structure of computer science.

Page 45: Programming's Greatest Hits of the 60s and 70s

37

Page 46: Programming's Greatest Hits of the 60s and 70s

37

Page 47: Programming's Greatest Hits of the 60s and 70s

37

Page 48: Programming's Greatest Hits of the 60s and 70s

37

Page 49: Programming's Greatest Hits of the 60s and 70s

37

Page 50: Programming's Greatest Hits of the 60s and 70s

37

Page 51: Programming's Greatest Hits of the 60s and 70s

37

Page 52: Programming's Greatest Hits of the 60s and 70s

37

Page 53: Programming's Greatest Hits of the 60s and 70s

Binary Search2 4 7 9 11 13 34 37 92 1050 1 2 3 4 5 6 7 8 9

?

?

?Found It!

Page 54: Programming's Greatest Hits of the 60s and 70s

SOME SORTING REQUIRED.

INSERT SORT ALGORITHM NOW.

Page 55: Programming's Greatest Hits of the 60s and 70s

I have 2 values. I need 1.

Page 56: Programming's Greatest Hits of the 60s and 70s

Bit Concatenation

(x, y)

(x3x2x1x0, y3y2y1y0)

x3x2x1x0 y3y2y1y0

(9, 3)

(1001, 0011)

10010011

Page 57: Programming's Greatest Hits of the 60s and 70s

Bit Interleaving

(x, y)

(x3x2x1x0, y3y2y1y0)

x3y3x2y2x1y1x0y0

(9, 3)

(1001, 0011)

10000111

Page 58: Programming's Greatest Hits of the 60s and 70s

1966

G.M. Morton

Z Order

Page 59: Programming's Greatest Hits of the 60s and 70s

3 (0,3) (1,3) (2,3) (3,3)

2 (0,2) (1,2) (2,2) (3,2)

1 (0,1) (1,1) (2,1) (3,1)

0 (0,0) (1,0) (2,0) (3,0)

0 1 2 3

Page 60: Programming's Greatest Hits of the 60s and 70s

3 1010 10

1011 11

1110 14

1111 15

2 1000 8

1001 9

1100 12

1101 13

1 0010 2

0011 3

0110 6

0111 7

0 0000 0

0001 1

0100 4

0101 5

0 1 2 3

Page 61: Programming's Greatest Hits of the 60s and 70s

3 1010 10

1011 11

1110 14

1111 15

2 1000 8

1001 9

1100 12

1101 13

1 0010 2

0011 3

0110 6

0111 7

0 0000 0

0001 1

0100 4

0101 5

0 1 2 3

Newly created number determines order.

Page 62: Programming's Greatest Hits of the 60s and 70s

3 1010 10

1011 11

1110 14

1111 15

2 1000 8

1001 9

1100 12

1101 13

1 0010 2

0011 3

0110 6

0111 7

0 0000 0

0001 1

0100 4

0101 5

0 1 2 3

Newly created number determines order.

start

Page 63: Programming's Greatest Hits of the 60s and 70s

3 1010 10

1011 11

1110 14

1111 15

2 1000 8

1001 9

1100 12

1101 13

1 0010 2

0011 3

0110 6

0111 7

0 0000 0

0001 1

0100 4

0101 5

0 1 2 3

Newly created number determines order.

start

finish

Page 64: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 65: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 66: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 67: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 68: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 69: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 70: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 71: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 72: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 73: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 74: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 75: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 76: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 77: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 78: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 79: Programming's Greatest Hits of the 60s and 70s

3101010

101111

111014

111115

210008

10019

110012

110113

1 00102

00113

01106

01117

0 00000

00011

01004

01015

0 1 2 3

Page 80: Programming's Greatest Hits of the 60s and 70s
Page 81: Programming's Greatest Hits of the 60s and 70s

(0,0)

(1,1)

Page 82: Programming's Greatest Hits of the 60s and 70s
Page 83: Programming's Greatest Hits of the 60s and 70s
Page 84: Programming's Greatest Hits of the 60s and 70s
Page 85: Programming's Greatest Hits of the 60s and 70s
Page 86: Programming's Greatest Hits of the 60s and 70s
Page 87: Programming's Greatest Hits of the 60s and 70s
Page 88: Programming's Greatest Hits of the 60s and 70s
Page 89: Programming's Greatest Hits of the 60s and 70s
Page 90: Programming's Greatest Hits of the 60s and 70s
Page 91: Programming's Greatest Hits of the 60s and 70s

space-filling curve

Page 92: Programming's Greatest Hits of the 60s and 70s

Bit-interleaving can be extended to

multiple dimensions.

Page 93: Programming's Greatest Hits of the 60s and 70s

from space to graphs…

Page 94: Programming's Greatest Hits of the 60s and 70s

lost in suburbia

Page 95: Programming's Greatest Hits of the 60s and 70s

Blue Spruce Dr.

Arborwood Ct.

Elmwood St.

Blue Fir Ln.

Page 96: Programming's Greatest Hits of the 60s and 70s

Go right.

Page 97: Programming's Greatest Hits of the 60s and 70s

Go right.

19th CenturyCharles Pierre Trémaux

depth-first search

Page 98: Programming's Greatest Hits of the 60s and 70s
Page 99: Programming's Greatest Hits of the 60s and 70s
Page 100: Programming's Greatest Hits of the 60s and 70s
Page 101: Programming's Greatest Hits of the 60s and 70s
Page 102: Programming's Greatest Hits of the 60s and 70s
Page 103: Programming's Greatest Hits of the 60s and 70s
Page 104: Programming's Greatest Hits of the 60s and 70s
Page 105: Programming's Greatest Hits of the 60s and 70s
Page 106: Programming's Greatest Hits of the 60s and 70s
Page 107: Programming's Greatest Hits of the 60s and 70s
Page 108: Programming's Greatest Hits of the 60s and 70s
Page 109: Programming's Greatest Hits of the 60s and 70s
Page 110: Programming's Greatest Hits of the 60s and 70s
Page 111: Programming's Greatest Hits of the 60s and 70s
Page 112: Programming's Greatest Hits of the 60s and 70s
Page 113: Programming's Greatest Hits of the 60s and 70s

BREADTH-FIRST SEARCH

Page 114: Programming's Greatest Hits of the 60s and 70s

BREADTH-FIRST SEARCH1950s

Page 115: Programming's Greatest Hits of the 60s and 70s

BREADTH-FIRST SEARCH1950s

Page 116: Programming's Greatest Hits of the 60s and 70s
Page 117: Programming's Greatest Hits of the 60s and 70s

A

B2

C3

2

D4 2

E

4

1

4

My Example Graph

Page 118: Programming's Greatest Hits of the 60s and 70s

Open List

A

B2

C3

2

D4 2

E

4

1

4

My Example Graph

Page 119: Programming's Greatest Hits of the 60s and 70s

Open List

A

B2

C3

2

D4 2

E

4

1

4

My Example Graph

sum of all costs to get here

Page 120: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

A

B2

C3

2

D4 2

E

4

1

4

My Example Graph

sum of all costs to get here

Page 121: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

A 0

A

Page 122: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

A 0

A

B2

C3

D4

Page 123: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

A 0

A

B2

C3

D4

B 2

C 3

D 4

Page 124: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

B 2

C 3

D 4

A 0

A

B2

C3

2

D4

E

4

My Example Graph

Page 125: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

C 3

D 4

E 6

A 0

B 2

A

B2

C3

2

D4

E

4

My Example Graph

Page 126: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

C 3

D 4

E 6

A 0

B 2

A

B2

C3

2

D4 2

E1

4

My Example Graph

Page 127: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

D 4

E 4

A 0

B 2

C 3

A

B2

C3

2

D4 2

E1

4

My Example Graph

Page 128: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

E 4 A 0

B 2

C 3D 4A

B2

C3

2

D4 2

E

4

1

4

My Example Graph

Page 129: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

E 4 A 0

B 2

C 3D 4A

B2

C3

2

D4 2

E

4

1

4

My Example Graph

Page 130: Programming's Greatest Hits of the 60s and 70s

1956

Edsger W. Djikstra

Djikstra’s Algorithm

Hamilton Richards - manuscripts of Edsger W. Dijkstra, University Texas at Austin

Page 131: Programming's Greatest Hits of the 60s and 70s

1956

Edsger W. Djikstra

Djikstra’s Algorithm

Hamilton Richards - manuscripts of Edsger W. Dijkstra, University Texas at Austin

Page 132: Programming's Greatest Hits of the 60s and 70s

1968

Peter Hart, Nils Nilsson, & Bertram Raphael

A*A

Page 133: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

A

B2

C3

2

D4 2

E

4

1

4

My Example Graph

sum cost to get here plus distance to goal

0

2

2

13

Page 134: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

A 3

A

B2

C3

D4

My Example Graph

2

2

13

Page 135: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

B 4

C 4

D 6

A 3

A

B2

C3

D4

My Example Graph

2

2

13

Page 136: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

A 3

A

B2

C3

2

D4

E

4

My Example Graph

0

2

2

13

B 4

C 4

D 6

Page 137: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

A 3

B 4

A

B2

C3

2

D4

E

4

My Example Graph

0

2

2

13

C 4

D 6

E 6

Page 138: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

A

B2

C3

2

D4 2

E1

4

My Example Graph

0

2

2

13

A 3

B 4

C 4

D 6

E 6

Page 139: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

A

B2

C3

2

D4 2

E1

4

My Example Graph

0

2

2

13

A 3

B 4

C 4

E 4

D 6

Page 140: Programming's Greatest Hits of the 60s and 70s

Open List Closed List

A

B2

C3

2

D4 2

E1

4

My Example Graph

0

2

2

13

A 3

B 4

C 4

E 4

D 6

We didn’t have to close D.

Page 141: Programming's Greatest Hits of the 60s and 70s

Breadth-first Search

Page 142: Programming's Greatest Hits of the 60s and 70s

Breadth-first Search

Djikstra’s Algorithm

Page 143: Programming's Greatest Hits of the 60s and 70s

Breadth-first Search

Djikstra’s Algorithm

A*

Page 144: Programming's Greatest Hits of the 60s and 70s

The power of heuristics.

Breadth-first Search

Djikstra’s Algorithm

A*

Page 145: Programming's Greatest Hits of the 60s and 70s

Are all edge weights equal?

What’s your most expensive operation?

Do you have insights about your target?

Breadth-First

Djikstra

A*

yes

no

visitshe

uristic

s

?

?

?

Page 146: Programming's Greatest Hits of the 60s and 70s

breadth-first search f(x) = c

djikstra’s algorithm f(x) = g(x) + c

a* f(x) = g(x) + h(x) + c

The others were specializations.

Page 147: Programming's Greatest Hits of the 60s and 70s

and we can do more than search with graphs…

Page 148: Programming's Greatest Hits of the 60s and 70s

1974

Charles L. Forgy

Rete

Page 149: Programming's Greatest Hits of the 60s and 70s

Premise 1

Premise 2

Premise 3

Conclusion

Rules

Page 150: Programming's Greatest Hits of the 60s and 70s

Premise 1

Premise 2

Premise 3

Take Action

Rules

Page 151: Programming's Greatest Hits of the 60s and 70s

(Premise 1, Premise 2, Premise 3)

(Action)

=>

Page 152: Programming's Greatest Hits of the 60s and 70s

(Premise 1, Premise 2, Premise 3)

(Action)

=>Left Hand Side

Page 153: Programming's Greatest Hits of the 60s and 70s

(Premise 1, Premise 2, Premise 3)

(Action)

=>Left Hand Side

Right Hand Side

Page 154: Programming's Greatest Hits of the 60s and 70s

A

B

C

D

ERules are a

directed acyclic graph.

Page 155: Programming's Greatest Hits of the 60s and 70s

like a trie

C

I OH

I DT

C EY

A K

G E

O N

Page 156: Programming's Greatest Hits of the 60s and 70s

Root Node

Page 157: Programming's Greatest Hits of the 60s and 70s

Root Node

Type Nodes

Page 158: Programming's Greatest Hits of the 60s and 70s

Root Node

Selection Nodes

Type Nodes

Page 159: Programming's Greatest Hits of the 60s and 70s

Root Node

Negation Nodes

Selection Nodes

Type Nodes

Page 160: Programming's Greatest Hits of the 60s and 70s

Root Node

Join Nodes

Negation Nodes

Selection Nodes

Type Nodes

Page 161: Programming's Greatest Hits of the 60s and 70s

Root Node

Terminal Nodes

Join Nodes

Negation Nodes

Selection Nodes

Type Nodes

Page 162: Programming's Greatest Hits of the 60s and 70s

Root Node

Alpha Memory

Terminal Nodes

Join Nodes

Negation Nodes

Selection Nodes

Type Nodes

Page 163: Programming's Greatest Hits of the 60s and 70s

Root Node

Beta Memory

Alpha Memory

Terminal Nodes

Join Nodes

Negation Nodes

Selection Nodes

Type Nodes

Page 164: Programming's Greatest Hits of the 60s and 70s

recommend-diet-changes

Hypertension (severity == moderate)

Demographics (age > 60)

prescribe-bp-meds

Hypertension

HypertensionDemographics

Hypertension (severity == moderate)

Ryan Brush “Retaking Rules for Developers”

Page 165: Programming's Greatest Hits of the 60s and 70s

Hypertension

Demographics Hypertension (severity == moderate)

Demographics (age > 60)

recommend-diet-changes

prescribe-bp-meds

Ryan Brush “Retaking Rules for Developers”

Page 166: Programming's Greatest Hits of the 60s and 70s

Sometimes our job is to find ways to not write code.

Page 167: Programming's Greatest Hits of the 60s and 70s

Let’s not build an expert system!

Page 168: Programming's Greatest Hits of the 60s and 70s

Let’s not build an expert system!

Page 169: Programming's Greatest Hits of the 60s and 70s

Let’s not build an expert system!

Page 170: Programming's Greatest Hits of the 60s and 70s

(-­‐>clara)

Let’s not build an expert system!

Page 171: Programming's Greatest Hits of the 60s and 70s

(-­‐>clara)

+

=

Page 172: Programming's Greatest Hits of the 60s and 70s

(-­‐>clara)

+

=

Page 173: Programming's Greatest Hits of the 60s and 70s

Triskel99 - Own work AMC Pacer, photographed during August 2009.

Page 174: Programming's Greatest Hits of the 60s and 70s

Efficacy

Cost

Convenience

Page 175: Programming's Greatest Hits of the 60s and 70s

import  java.util.Comparator;  

public  class  ChoiceComparator  implements  Comparator<Choice>  {  

       @Override          public  int  compare(Choice  o1,  Choice  o2)  {                if(  o2.getEfficacy()  ==  o1.getEfficacy)  {                        if(  o2.getCost()  ==  o1.getCost)  {                                return  o2.getConvenience()  -­‐  o1.getConvenience();                        }                          return  o2.getCost()  -­‐  o1.getCost();                }                return  o2.getEfficacy()  -­‐  o2.getEfficacy();          }  }  

Page 176: Programming's Greatest Hits of the 60s and 70s

import  java.util.Comparator;  

public  class  ChoiceComparator  implements  Comparator<Choice>  {  

       @Override          public  int  compare(Choice  o1,  Choice  o2)  {                if(  o2.getEfficacy()  ==  o1.getEfficacy)  {                        if(  o2.getCost()  ==  o1.getCost)  {                                return  o2.getConvenience()  -­‐  o1.getConvenience();                        }                          return  o2.getCost()  -­‐  o1.getCost();                }                return  o2.getEfficacy()  -­‐  o2.getEfficacy();          }  }  

Page 177: Programming's Greatest Hits of the 60s and 70s

public  class  EfficacyComparator  implements  Comparator<Choice>  

public  class  CostComparator  implements  Comparator<Choice>  

public  class  ConvenienceComparator  implements  Comparator<Choice>  

1.SORT  2.TAKE  10  3.GOTO  1

Page 178: Programming's Greatest Hits of the 60s and 70s

public  class  EfficacyComparator  implements  Comparator<Choice>  

public  class  CostComparator  implements  Comparator<Choice>  

public  class  ConvenienceComparator  implements  Comparator<Choice>  

1.SORT  2.TAKE  10  3.GOTO  1

Page 179: Programming's Greatest Hits of the 60s and 70s

1974

Jon L. Bentley & Raphael Finkel

Quad-Trees

Page 180: Programming's Greatest Hits of the 60s and 70s

1966

G.M. Morton

Z Order

Page 181: Programming's Greatest Hits of the 60s and 70s

for(int i = 0; i < count1; ++i) { for(int j = 0; j < count2; ++j) { for(int k = 0; k < count3; ++k) { for(int l = 0; l < count4; ++l) { for(int m = 0; m < count5; ++m) { for(int n = 0; n < count6; ++n) { for(int o = 0; o < count7; ++o) { for(int p = 0; p < count8; ++p) { for(int q = 0; q < count9; ++q) { for(int r = 0; r < count10; ++r) { for(int s = 0; s < count 11 for(int t = 0; t < count for(int u = 0; for(int v = 0 for(int w for(i fo

for-nado?

Page 182: Programming's Greatest Hits of the 60s and 70s

You are using the wrong algorithm.

Page 183: Programming's Greatest Hits of the 60s and 70s

Crack open an algorithms book.

Page 184: Programming's Greatest Hits of the 60s and 70s

Do a Depth-First Search of Wikipedia

Page 185: Programming's Greatest Hits of the 60s and 70s

Do a Depth-First Search of Wikipedia

Page 186: Programming's Greatest Hits of the 60s and 70s

Your solution is out there.

BLOOM FILTER

trie

Gale Shapley

A*

R-Tree

TREAP

Dijkstra’s

Floyd Warshall

D* Hu

ffm

anID

3

CARTRet

e

Page 187: Programming's Greatest Hits of the 60s and 70s

And  to  be  honest…

It  is  probably  from  the  60s  or  70s.

Page 188: Programming's Greatest Hits of the 60s and 70s

1979Engineering Director, Cerner Corporation Chapter Leader, Kansas City Girl Develop It Conference Organizer, Midwest.io

@michellebrush

Michelle Brush