24
ACM reminders October 30 -- HMC Mock contest Good times ? November 10 -- ACM contest November 13 -- Final acm class & contest wrap-up Pending Azusa Pacific University : 4Alpha2Omega Pending Brigham Young University -- Hawaii Campus : C-Siders 1 Pending Brigham Young University -- Hawaii Campus : C-Siders 2 Pending California Lutheran University : Java the Hut Pending California Lutheran University : Just Wanna Program Pending California Lutheran University : javac this.java Pending California State University Long Beach : Beach1 Pending California State University Long Beach : Beach2 Pending California State University Long Beach : Beach3 Pending California State University, Northridge : CSUN Red Pending California State University, Northridge : CSUN Black Pending California State University, Northridge : CSUN-3 Pending El Camino College : ECC Beta Accepted Harvey Mudd College : HMC 1 Accepted Harvey Mudd College : HMC 2 Accepted Harvey Mudd College : HMC 3 Pending Mount San Antonio College : MtSAC@Voidies$qf Pending Mount San Antonio College : MtSAC@Floaties$qi Pending Riverside Community College : Platinum Pending Riverside Community College : The Code Machine Pending Riverside Community College : CodeBlue Pending University of California, San Diego : UCSD Rock Pending University of California, San Diego : UCSD Paper Pending University of California, San Diego : UCSD Scissors Pending University of Southern California : Trojan Horse Pending University of Southern California : Trojan Pride Pending University of Southern California : Trojans current list of competitors

ACM reminders

  • Upload
    glenys

  • View
    59

  • Download
    2

Embed Size (px)

DESCRIPTION

ACM reminders. October 30 -- HMC Mock contest. Good times ?. November 10 -- ACM contest. current list of competitors. Accepted Harvey Mudd College : HMC 1 Accepted Harvey Mudd College : HMC 2 Accepted Harvey Mudd College : HMC 3 Pending Mount San Antonio College : MtSAC@Voidies$qf - PowerPoint PPT Presentation

Citation preview

Page 1: ACM reminders

ACM reminders

October 30 -- HMC Mock contest

Good times ?

November 10 -- ACM contest

November 13 -- Final acm class & contest wrap-up

Pending Azusa Pacific University: 4Alpha2Omega Pending Brigham Young University -- Hawaii Campus: C-Siders 1 Pending Brigham Young University -- Hawaii Campus: C-Siders 2 Pending California Lutheran University: Java the Hut Pending California Lutheran University: Just Wanna Program Pending California Lutheran University: javac this.java Pending California State University Long Beach: Beach1 Pending California State University Long Beach: Beach2 Pending California State University Long Beach: Beach3 Pending California State University, Northridge: CSUN Red Pending California State University, Northridge: CSUN Black Pending California State University, Northridge: CSUN-3 Pending El Camino College: ECC Beta

Accepted Harvey Mudd College: HMC 1 Accepted Harvey Mudd College: HMC 2 Accepted Harvey Mudd College: HMC 3 Pending Mount San Antonio College: MtSAC@Voidies$qf Pending Mount San Antonio College: MtSAC@Floaties$qi Pending Riverside Community College: Platinum Pending Riverside Community College: The Code Machine Pending Riverside Community College: CodeBlue Pending University of California, San Diego: UCSD Rock Pending University of California, San Diego: UCSD Paper Pending University of California, San Diego: UCSD Scissors Pending University of Southern California: Trojan Horse Pending University of Southern California: Trojan Pride Pending University of Southern California: Trojans

current list of competitors

Page 2: ACM reminders

C++ Map

multimap#include <map>

map#include <map>

www.dinkumware.com/htm_cpl/index.html www.sgi.com/tech/stl/

set of key/value pairs

Page 3: ACM reminders

C++ Map

multimap#include <map>

map#include <map>

www.dinkumware.com/htm_cpl/index.html www.sgi.com/tech/stl/

set of key/value pairs

(implemented as a balanced binary tree)

Page 4: ACM reminders

C++ Map

multimap#include <map>

map#include <map>

www.dinkumware.com/htm_cpl/index.html www.sgi.com/tech/stl/

set of key/value pairs

(implemented as a balanced binary tree)Fast: searching by key

Slow: searching by value

Page 5: ACM reminders

C++ Map

#define MP make_pair

typedef pair<int,int> PII;

map<PII,int> m;

m[MP(0,1)] = 10;

m[MP(0,2)] = 17;

m[MP(1,2)] = 5;

m[MP(2,0)] = 12; // probably not worth it for graphs...

map<string,int> m; // definitely worth it here

m[“ArcOS”] = 110; // as an associative array

m[“TheoComp”] = 140;

multimap<string,string> d; // as a dictionary

d.insert(MP(“fun”,“c++ coding”)); // methods exist to get

d.insert(MP(“fun”,“ACM coding”)); // all of “fun”s entries

0

2

110

17512

Page 6: ACM reminders

Geometric Problems

Problem 1 - Binary Space Partitions

observerBasic idea: draw objects from far (first) to near (last).

Page 7: ACM reminders

Geometric Problems

Problem 1 - Binary Space Partitions

observerBasic idea: draw objects from far (first) to near (last).

z

x

(0,-big)

(100,200)

(100,220)

(70,200)

(70,220)

(70,50)

(70,70)

(40,50)

(40,70)

(50,220)

(50,240)

(20,220)

(20,240)

(-30,210)

(-30,230)

(-60,210)

(-60,230)

(-20,60)

(-20,80)

(-50,60)

(-50,80)

A

BC

D

E

Page 8: ACM reminders

Geometric Problems

Problem 1 - Binary Space Partitions

Input: 54 -50 60 -20 60 -20 80 -50 804 -60 210 -30 210 -30 230 -60 2304 20 220 50 220 50 240 20 2404 70 200 100 200 100 220 70 2204 40 50 70 50 70 70 40 70

first part

Page 9: ACM reminders

Geometric Problems

Problem 1 - Binary Space Partitions

observerBasic idea: draw objects from far (first) to near (last).

z

x

(0,-big)

(100,200)

(100,220)

(70,200)

(70,220)

(70,50)

(70,70)

(40,50)

(40,70)

(50,220)

(50,240)

(20,220)

(20,240)

(-30,210)

(-30,230)

(-60,210)

(-60,230)

(-20,60)

(-20,80)

(-50,60)

(-50,80)

A

BC

D

E

(0,140)

(-15,0)

Page 10: ACM reminders

Geometric Problems

Problem 1 - Binary Space Partitions

observer

Basic idea: draw objects from far (first -- LEFT) to

near (last -- RIGHT).

z

x

(0,-big)

A

BC

D

E

(0,140)

(-15,0)

ABCDE

Page 11: ACM reminders

Geometric Problems

Problem 1 - Binary Space Partitions

observer

Basic idea: draw objects from far (first -- LEFT) to

near (last -- RIGHT).

z

x

(0,-big)

A

BC

D

E

(0,140)

(-15,0)

ABCDE

(70,150)

(-70,150)

A BCDE

Page 12: ACM reminders

Geometric Problems

Problem 1 - Binary Space Partitions

Input: 54 -50 60 -20 60 -20 80 -50 804 -60 210 -30 210 -30 230 -60 2304 20 220 50 220 50 240 20 2404 70 200 100 200 100 220 70 2204 40 50 70 50 70 70 40 7020 140 -15 070 150 -70 150

first part

second part

Page 13: ACM reminders

Geometric Problems

Problem 1 - Binary Space Partitions

Input: 54 -50 60 -20 60 -20 80 -50 804 -60 210 -30 210 -30 230 -60 2304 20 220 50 220 50 240 20 2404 70 200 100 200 100 220 70 2204 40 50 70 50 70 70 40 7020 140 -15 070 150 -70 150

first part

second part

Output: ECDAB the objects, in the order they would be rendered by this BSP

Page 14: ACM reminders

Geometric Problems

Problem 2 - Visualizing cubes

3 3 1

3 1

2

Page 15: ACM reminders

Geometric Problems

Problem 2 - Visualizing cubes

3 3 1

3 1

2

Suppose you rotate so that

left wall right wall

floor

left wall floor

floor right wall

right wall left wall

What is the resulting stacking pattern?

Page 16: ACM reminders

Geometric Problems

Problem 2 - Visualizing cubes

3 3 1

3 1

2

Suppose you rotate so that

left wall right wall

floor

left wall floor

floor right wall

right wall left wall

What is the resulting stacking pattern?

3 2 1

2 1 1

2 1

Page 17: ACM reminders

Geometric Problems

Problem 2 - Visualizing cubes

?!?

Page 18: ACM reminders

All-pairs shortest paths

A

B

ED

C

8

13

1

6

12

9

7 0

11

0 8 13 - 1- 0 - 6 12

- 9 0 - -

7 - 0 0 -

- - - 11 0

AB

C

D

E

A B C D E

from

to

“Floyd-Warshall algorithm”

Page 19: ACM reminders

All-pairs shortest paths

A

B

ED

C

8

13

1

6

12

9

7 0

11

0 8 13 - 1- 0 - 6 12

- 9 0 - -

7 - 0 0 -

- - - 11 0

AB

C

D

E

A B C D E

from

to

“Floyd-Warshall algorithm”

D0 = (dij )0

dij = shortest distance from i to j through nodes {1, …, k} k

dij = shortest distance from i to j through no nodes 0

Page 20: ACM reminders

All-pairs shortest paths

A

B

ED

C

8

13

1

6

12

9

7 0

11

0 8 13 - 1- 0 - 6 12

- 9 0 - -

7 - 0 0 -

- - - 11 0

AB

C

D

E

A B C D E

from

to

“Floyd-Warshall algorithm”

D0 = (dij )0

dij =k

dij = shortest distance from i to j through nodes {1} 1

Page 21: ACM reminders

All-pairs shortest paths...

0 8 13 - 1- 0 - 6 12

- 9 0 - -

7 - 0 0 -

- - - 11 0

AB

C

D

E

D0 = (dij )0

0 8 13 - 1- 0 - 6 12

- 9 0 - -

7 - 0 0 -

- - - 11 0

AB

C

D

E

D1 = (dij )1

dij = shortest distance from i to j through nodes {1, …, k} k

dij =k

0 8 13 - 1- 0 - 6 12

- 9 0 - -

7 15 0 0 8

- - - 11 0

AB

C

D

E

“Floyd-Warshall algorithm”

Page 22: ACM reminders

All-pairs shortest paths...

0 8 13 - 1- 0 - 6 12

- 9 0 - -

7 - 0 0 -

- - - 11 0

AB

C

D

E

D0 = (dij )0

0 8 13 - 1- 0 - 6 12

- 9 0 - -

7 - 0 0 -

- - - 11 0

AB

C

D

E

D1 = (dij )1

dij = shortest distance from i to j through {1, …, k} k

dij =k

0 8 13 - 1- 0 - 6 12

- 9 0 - -

7 15 0 0 8

- - - 11 0

AB

C

D

E

“Floyd-Warshall algorithm”

Page 23: ACM reminders

All-pairs shortest paths...

0 8 13 - 1- 0 - 6 12

- 9 0 - -

7 - 0 0 -

- - - 11 0

AB

C

D

E

D0 = (dij )0

0 8 13 - 1- 0 - 6 12

- 9 0 - -

7 - 0 0 -

- - - 11 0

AB

C

D

E

D1 = (dij )1

dij = shortest distance from i to j through {1, …, k} k

dij =k

0 8 13 - 1- 0 - 6 12

- 9 0 - -

7 15 0 0 8

- - - 11 0

AB

C

D

E

“Floyd-Warshall algorithm”

Page 24: ACM reminders

All-pairs shortest paths...

0 8 13 14 1- 0 - 6 12

- 9 0 15 21

7 15 0 0 8

- - - 11 0

AB

C

D

E

D2 = (dij )2

0 8 13 14 1- 0 - 6 12

- 9 0 15 21

7 9 0 0 8

- - - 11 0

AB

C

D

E

D3 = (dij )3

0 8 13 14 113 0 6 6 12

22 9 0 15 21

7 9 0 0 8

18 20 11 11 0

AB

C

D

E

D4 = (dij )4

AB

C

D

E

D5 = (dij )5

to store the path, another matrix can track the last intermediate vertex

0 8 12 12 113 0 6 6 12

22 9 0 15 21

7 9 0 0 8

18 20 11 11 0