Placeholder Image

字幕表 動画を再生する

  • OK, so the goal at hand is here, I have two glasses of colored water.

  • So we have some purple here.


  • OK.

  • And we've got some green here.


  • 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.


  • 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.


  • 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.



  • [CHEERS]

  • OK, very clever.

  • Supposing you can't just move things around

  • in memory, what if I gave you a temporary variable.


  • DAVID J. MALAN: Does this help?

  • FARRAH: Yes.

  • DAVID J. MALAN: So how can we now get purple in there and green in there?


  • 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.


  • OK.

  • So purple goes into the temporary, very nice.


  • 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.


  • Thank you.

  • FARRAH: Thank you.

OK, so the goal at hand is here, I have two glasses of colored water.


動画の操作 ここで「動画」の調整と「字幕」の表示を設定することができます

A2 初級

CS50 2019 - 再生4 - 一時保管 (CS50 2019 - Lecture 4 - Temporary Storage)

  • 0 0
    林宜悉 に公開 2021 年 01 月 14 日