Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Class 28: Growing Trees

Class 28: Growing Trees

cs1120: Introduction to Computing
Explorations in Language, Logic, and Machine
University of Virginia, Spring 2016

http://xplorecs.org/class28

Class 28:
Logarithms
N < Trillion, log N is basically a constant!
Trees from Lists
Implementing Trees

David Evans

April 06, 2016
Tweet

More Decks by David Evans

Other Decks in Programming

Transcript

  1. Class 28: Growing Trees Introduction to Computing: Explorations in Language,

    Logic, and Machines cs1120 Spring 2016 David Evans University of Virginia
  2. Remembering Logarithms logb n = x means bx = n

    What is log2 1000? What is log10 1000?
  3. #7 Changing Bases logb n = (1/logk b) logk n

    ϴ(log2 n) = ϴ(log10 n) = ϴ(log n) No need to include a constant base within asymptotic operators.
  4. Common Costs (Class 20) Impact of increasing input size by

    1 Asymptotic Cost Notation (N is size of input) No increase in cost Constant O(1) Increases by fixed amount Linear ϴ(N) Increases by size of input Quadratic ϴ(N2) Doubles cost Exponential ϴ(2N)
  5. Common Costs Impact of increasing input size Asymptotic Cost Notation

    (N is size of input) No increase in cost Constant O(1) Doubling size of input increases cost by fixed amount Logarithmic ϴ(log N) Doubling size of input doubles cost Linear ϴ(N) Doubling size of input, quadruples cost Quadratic ϴ(N2) Increasing size by 1, doubles cost Exponential ϴ(2N)
  6. Charge • Project 5: target completing by Monday If you

    are stuck, not making progress, or unsure what you should be doing, make sure to check in with me today or at office hours tomorrow.