Presentation is loading. Please wait.

Presentation is loading. Please wait.

ACM reminders October 30 -- HMC Mock contest Good times ? November 10 -- ACM contest November 13 -- Final acm class & contest wrap-up PendingAzusa Pacific.

Similar presentations


Presentation on theme: "ACM reminders October 30 -- HMC Mock contest Good times ? November 10 -- ACM contest November 13 -- Final acm class & contest wrap-up PendingAzusa Pacific."— Presentation transcript:

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

2 C++ Map multimap #include map #include www.dinkumware.com/htm_cpl/index.htmlwww.sgi.com/tech/stl/ set of key/value pairs

3 C++ Map multimap #include map #include www.dinkumware.com/htm_cpl/index.htmlwww.sgi.com/tech/stl/ set of key/value pairs (implemented as a balanced binary tree)

4 C++ Map multimap #include map #include www.dinkumware.com/htm_cpl/index.htmlwww.sgi.com/tech/stl/ set of key/value pairs (implemented as a balanced binary tree) Fast: searching by key Slow: searching by value

5 C++ Map #define MP make_pair typedef pair PII; map 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 m; // definitely worth it here m[“ArcOS”] = 110; // as an associative array m[“TheoComp”] = 140; multimap 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 1 10 17 5 12

6 Geometric Problems Problem 1 - Binary Space Partitions observer Basic idea: draw objects from far (first) to near (last).

7 Geometric Problems Problem 1 - Binary Space Partitions observer Basic 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 B C D E

8 Geometric Problems Problem 1 - Binary Space Partitions Input: 5 4 -50 60 -20 60 -20 80 -50 80 4 -60 210 -30 210 -30 230 -60 230 4 20 220 50 220 50 240 20 240 4 70 200 100 200 100 220 70 220 4 40 50 70 50 70 70 40 70 first part

9 Geometric Problems Problem 1 - Binary Space Partitions observer Basic 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 B C D E (0,140) (-15,0)

10 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 B C D E (0,140) (-15,0) ABCDE

11 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 B C D E (0,140) (-15,0) ABCDE (70,150) (-70,150) ABCDE

12 Geometric Problems Problem 1 - Binary Space Partitions Input: 5 4 -50 60 -20 60 -20 80 -50 80 4 -60 210 -30 210 -30 230 -60 230 4 20 220 50 220 50 240 20 240 4 70 200 100 200 100 220 70 220 4 40 50 70 50 70 70 40 70 2 0 140 -15 0 70 150 -70 150 first part second part

13 Geometric Problems Problem 1 - Binary Space Partitions Input: 5 4 -50 60 -20 60 -20 80 -50 80 4 -60 210 -30 210 -30 230 -60 230 4 20 220 50 220 50 240 20 240 4 70 200 100 200 100 220 70 220 4 40 50 70 50 70 70 40 70 2 0 140 -15 0 70 150 -70 150 first part second part Output: ECDAB the objects, in the order they would be rendered by this BSP

14 Geometric Problems Problem 2 - Visualizing cubes 3 3 1 3 1 2

15 Geometric Problems Problem 2 - Visualizing cubes 3 3 1 3 1 2 Suppose you rotate so that left wall right wall floor left wallfloor right wall left wall What is the resulting stacking pattern?

16 Geometric Problems Problem 2 - Visualizing cubes 3 3 1 3 1 2 Suppose you rotate so that left wall right wall floor left wallfloor right wall left wall What is the resulting stacking pattern? 3 2 1 2 1 1 2 1

17 Geometric Problems Problem 2 - Visualizing cubes ?!?

18 All-pairs shortest paths A B E D C 8 13 1 6 12 9 7 0 11 0813-1 -0-612 -90-- 7-00- ---110 A B C D E A BC DE from to “Floyd-Warshall algorithm”

19 All-pairs shortest paths A B E D C 8 13 1 6 12 9 7 0 11 0813-1 -0-612 -90-- 7-00- ---110 A B C D E A BC DE from to “Floyd-Warshall algorithm” D 0 = (d ij ) 0 d ij = shortest distance from i to j through nodes {1, …, k} k d ij = shortest distance from i to j through no nodes 0

20 All-pairs shortest paths A B E D C 8 13 1 6 12 9 7 0 11 0813-1 -0-612 -90-- 7-00- ---110 A B C D E A BC DE from to “Floyd-Warshall algorithm” D 0 = (d ij ) 0 d ij = k d ij = shortest distance from i to j through nodes {1} 1

21 All-pairs shortest paths... 0813-1 -0-612 -90-- 7-00- ---110 A B C D E D 0 = (d ij ) 0 0813-1 -0-612 -90-- 7-00- ---110 A B C D E D 1 = (d ij ) 1 d ij = shortest distance from i to j through nodes {1, …, k} k d ij = k 0813-1 -0-612 -90-- 7 15 00 8 ---110 A B C D E “Floyd-Warshall algorithm”

22 All-pairs shortest paths... 0813-1 -0-612 -90-- 7-00- ---110 A B C D E D 0 = (d ij ) 0 0813-1 -0-612 -90-- 7-00- ---110 A B C D E D 1 = (d ij ) 1 d ij = shortest distance from i to j through {1, …, k} k d ij = k 0813-1 -0-612 -90-- 7 15 00 8 ---110 A B C D E “Floyd-Warshall algorithm”

23 All-pairs shortest paths... 0813-1 -0-612 -90-- 7-00- ---110 A B C D E D 0 = (d ij ) 0 0813-1 -0-612 -90-- 7-00- ---110 A B C D E D 1 = (d ij ) 1 d ij = shortest distance from i to j through {1, …, k} k d ij = k 0813-1 -0-612 -90-- 7 15 00 8 ---110 A B C D E “Floyd-Warshall algorithm”

24 All-pairs shortest paths... 0813 14 1 -0-612 -901521 715008 ---110 A B C D E D 2 = (d ij ) 2 0813141 -0-612 -901521 7 9 008 ---110 A B C D E D 3 = (d ij ) 3 0813141 130 6 612 22901521 79008 182011 0 A B C D E D 4 = (d ij ) 4 A B C D E D 5 = (d ij ) 5 to store the path, another matrix can track the last intermediate vertex 0812 1 1306612 22901521 79008 182011 0


Download ppt "ACM reminders October 30 -- HMC Mock contest Good times ? November 10 -- ACM contest November 13 -- Final acm class & contest wrap-up PendingAzusa Pacific."

Similar presentations


Ads by Google