📁
SICP
  • README
  • Building Abstractions With Procedures
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
Powered by GitBook
On this page

Was this helpful?

  1. Building Abstractions With Procedures

14

Exercise 1.14: Draw the tree illustrating the process generated by the count-change procedure of 1.2.2 in making change for 11 cents. What are the orders of growth of the space and number of steps used by this process as the amount to be changed increases?”

                     count-change 11
                           |
                           |
                        cc 11 3
                           /\
                          /  \
                         /    \
                        /      \
                    cc 11 2   cc 1 3
                      /\         |
                     /  \        1
                    /    \
                   /      \
               cc 11 1   cc 6 3
                   |         /\
                   1        /  \
                           /    \
                          /      \
                      cc 6 1    cc 1 2
                         |         |
                         1         1
ResourceOfSpace(n)=θ(2n50)ResourceOfSpace(n) = \theta(2^{\frac{n}{50}})ResourceOfSpace(n)=θ(250n​)
ResourceOfTime(n)=θ(2n50+1)ResourceOfTime(n) = \theta(2^{\frac{n}{50}+1})ResourceOfTime(n)=θ(250n​+1)
Previous13Next15

Last updated 4 years ago

Was this helpful?