字幕表 動画を再生する 英語字幕をプリント OK, so the goal at hand is here, I have two glasses of colored water. So we have some purple here. [WATER POURING] OK. And we've got some green here. [WATER POURING] And the only goal at hand is to do a very simple operation like we needed to do quite a bit last week, which is to swap two variables just like we swap two numbers. So if you could go ahead and get the purple liquid in here and the green liquid in here, go. [CHUCKLE] FARRAH: Is it OK if they overlap? DAVID J. MALAN: Ideally, no. We want to put only purple here, and only green here, and no temporary store. [LAUGHTER] FARRAH: Oh. DAVID J. MALAN: OK, but you're hesitating. Why? FARRAH: Because you told me they couldn't touch [CHUCKLE] and-- DAVID J. MALAN: Well, you can touch the glasses. But you're hesitating to swap them, why? [CLINK] OK, that's just cheating. [LAUGHTER] [APPLAUSE] [CHEERS] OK, very clever. Supposing you can't just move things around in memory, what if I gave you a temporary variable. FARRAH: OK. DAVID J. MALAN: Does this help? FARRAH: Yes. DAVID J. MALAN: So how can we now get purple in there and green in there? [CHUCKLE] FARRAH: Can I put purple in here first? DAVID J. MALAN: Sure. FARRAH: I'm going to spill it. DAVID J. MALAN: It's OK. [WATER POURING] OK. So purple goes into the temporary, very nice. [APPLAUSE] FARRAH: Thank you. DAVID J. MALAN: Green goes into what was purple. FARRAH: Yes DAVID J. MALAN: OK, good. And then purple goes in-- from the temporary variable into the original green glass. Now, a proper round of applause if we could. OK. [APPLAUSE] Thank you. FARRAH: Thank you.