Return to Video

06-37 Platos Republic

  • 0:00 - 0:02
    [Which of the following could be simplified or removed without changing the result?]
  • 0:02 - 0:05
    So you may already have a good intuition for these sorts of optimizations.
  • 0:05 - 0:07
    Let me give you a chance to show that off.
  • 0:07 - 0:10
    So here I've written a function in JavaScript called Plato's Republic.
  • 0:10 - 0:12
    It's a function of 2 variables: A and B.
  • 0:12 - 0:16
    A gets A times 1, B gets B + 0, A gets A + B,
  • 0:16 - 0:19
    B gets B + 2, and then finally we return A.
  • 0:19 - 0:21
    There are 5 possible statements here.
  • 0:21 - 0:24
    Which of them can be simplified or removed
  • 0:24 - 0:26
    without changing the result?
  • 0:26 - 0:29
    And here I really want you to mostly focus on removing,
  • 0:29 - 0:32
    and note that this is a little trickier than it looks.
  • 0:32 -
    So give it some thought.
Title:
06-37 Platos Republic
Description:

Other units in this course below:
Unit 1:http://www.youtube.com/playlist?list=PL3FEF9299137945CC
Unit 2:http://www.youtube.com/playlist?list=PLBF6FC32358457242
Unit 3:http://www.youtube.com/playlist?list=PL30EF9EB86B4D2E54
Unit 4:http://www.youtube.com/playlist?list=PL6881C8D2E9D63242
Unit 5:http://www.youtube.com/playlist?list=PL62AF1F6D3B654E14
Unit 6:http://www.youtube.com/playlist?list=PL8FCC9D9C45A6640E
Unit 7:http://www.youtube.com/playlist?list=PL9533BCB71FD88E38

Q&A: http://www.youtube.com/playlist?list=PLE0EB375FA373A866

To gain access to interactive quizzes, homework, programming assignments and a helpful community, join the class at http://www.udacity.com

more » « less
Video Language:
English
Team:
Udacity
Project:
CS262 - Programming Languages
Duration:
0:35
Amara Bot added a translation

English subtitles

Revisions