CS130-exercise-solutions-1

72F6E1281BFBD89B0B423172C055D5B5-annotated.jpg IMAGE

For example if \( n = 6 \) :

\[\begin{aligned} t(n) &= t(n) \cdot t(n-1) \cdot t(n-2) \cdot t(n-3) \cdot t(n-4) \cdot t(n-5) \\ &= \underbrace{6 \cdot 5 \cdot 4 \cdot 3 \cdot 2 \cdot 1}_{\text{this happens } n \text{ times}} \end{aligned}\]

So we have a time complexity of \( O(n) \) .


4F0AA794B3B6E6C8D022677B5D6EA7C0 copy2.jpg


F408E97F997402E1D8D3BBFCEB1E8569-annotated.jpg


7F7AE5D7CEDB82541183A389658C1A11-annotated.jpg