Download presentation
Presentation is loading. Please wait.
Published byEverett Fields Modified over 9 years ago
1
Recursion (summary)
2
Two Categories Translation of recursive definition Factorial: fact(1) = 1; fact(N) = N * fact(N-1) Mystery: m(0) = 0; m(1) = 3; m(N)=3*m(N-1)+5*m(N-2) Divide and Conquer Hanoi: break problem of N into 2 problems of N-1 and “combine” solutions Guessing game: break problem of N into problem of N/2 and “combine”
3
In-Class Assignment Work in groups of up to three students Make sure that you turn in your paper with all group member’s names printed CLEARLY at the top This WILL be graded (though I’m not sure how soon)
4
Questions 1.Write a C function to compute Ackermann’s function (see definition of Ackermann’s function on screen. 2.Write a C function to compute a single element of Pascal’s triangle, pascal(m,n). Use the Pascal’s triangle shown on the screen. HINT: use divide and conquer, at each step converting a problem of with row N into a problem with row N-1. 3.Solve the puzzle shown on the screen.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.