1 00:00:00,000 --> 00:00:04,370 OK, so the goal at hand is here, I have two glasses of colored water. 2 00:00:04,370 --> 00:00:05,730 So we have some purple here. 3 00:00:05,730 --> 00:00:07,220 [WATER POURING] 4 00:00:07,220 --> 00:00:08,710 OK. 5 00:00:08,710 --> 00:00:10,520 And we've got some green here. 6 00:00:10,520 --> 00:00:11,670 [WATER POURING] 7 00:00:11,670 --> 00:00:15,080 And the only goal at hand is to do a very simple operation 8 00:00:15,080 --> 00:00:16,890 like we needed to do quite a bit last week, 9 00:00:16,890 --> 00:00:19,710 which is to swap two variables just like we swap two numbers. 10 00:00:19,710 --> 00:00:22,140 So if you could go ahead and get the purple liquid in here 11 00:00:22,140 --> 00:00:24,150 and the green liquid in here, go. 12 00:00:27,850 --> 00:00:28,350 [CHUCKLE] 13 00:00:28,350 --> 00:00:29,890 FARRAH: Is it OK if they overlap? 14 00:00:29,890 --> 00:00:31,060 DAVID J. MALAN: Ideally, no. 15 00:00:31,060 --> 00:00:33,570 We want to put only purple here, and only green here, 16 00:00:33,570 --> 00:00:35,360 and no temporary store. 17 00:00:35,360 --> 00:00:35,860 [LAUGHTER] 18 00:00:35,860 --> 00:00:36,950 FARRAH: Oh. 19 00:00:36,950 --> 00:00:38,700 DAVID J. MALAN: OK, but you're hesitating. 20 00:00:38,700 --> 00:00:39,900 Why? 21 00:00:39,900 --> 00:00:42,530 FARRAH: Because you told me they couldn't touch [CHUCKLE] and-- 22 00:00:42,530 --> 00:00:44,530 DAVID J. MALAN: Well, you can touch the glasses. 23 00:00:44,530 --> 00:00:46,260 But you're hesitating to swap them, why? 24 00:00:46,260 --> 00:00:46,920 [CLINK] 25 00:00:46,920 --> 00:00:48,140 OK, that's just cheating. 26 00:00:48,140 --> 00:00:49,600 [LAUGHTER] 27 00:00:49,600 --> 00:00:50,580 [APPLAUSE] 28 00:00:50,580 --> 00:00:53,030 [CHEERS] 29 00:00:53,030 --> 00:00:55,740 OK, very clever. 30 00:00:55,740 --> 00:00:57,870 Supposing you can't just move things around 31 00:00:57,870 --> 00:01:00,790 in memory, what if I gave you a temporary variable. 32 00:01:00,790 --> 00:01:01,290 FARRAH: OK. 33 00:01:01,290 --> 00:01:03,210 DAVID J. MALAN: Does this help? 34 00:01:03,210 --> 00:01:05,040 FARRAH: Yes. 35 00:01:05,040 --> 00:01:08,470 DAVID J. MALAN: So how can we now get purple in there and green in there? 36 00:01:08,470 --> 00:01:09,950 [CHUCKLE] 37 00:01:09,950 --> 00:01:11,990 FARRAH: Can I put purple in here first? 38 00:01:11,990 --> 00:01:12,870 DAVID J. MALAN: Sure. 39 00:01:12,870 --> 00:01:13,620 FARRAH: I'm going to spill it. 40 00:01:13,620 --> 00:01:14,950 DAVID J. MALAN: It's OK. 41 00:01:14,950 --> 00:01:15,950 [WATER POURING] 42 00:01:15,950 --> 00:01:16,990 OK. 43 00:01:16,990 --> 00:01:19,240 So purple goes into the temporary, very nice. 44 00:01:19,240 --> 00:01:19,740 [APPLAUSE] 45 00:01:19,740 --> 00:01:22,940 FARRAH: Thank you. 46 00:01:22,940 --> 00:01:25,190 DAVID J. MALAN: Green goes into what was purple. 47 00:01:25,190 --> 00:01:26,310 FARRAH: Yes 48 00:01:26,310 --> 00:01:28,820 DAVID J. MALAN: OK, good. 49 00:01:28,820 --> 00:01:31,550 And then purple goes in-- from the temporary variable 50 00:01:31,550 --> 00:01:34,040 into the original green glass. 51 00:01:34,040 --> 00:01:35,970 Now, a proper round of applause if we could. 52 00:01:35,970 --> 00:01:36,730 OK. 53 00:01:36,730 --> 00:01:37,230 [APPLAUSE] 54 00:01:37,230 --> 00:01:37,730 Thank you. 55 00:01:37,730 --> 00:01:38,700 FARRAH: Thank you.