quiz6bANS - f n-1 n 2 2 Give a recursive algorithm for...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Math 240, Quiz 6 Name: Circle One: T 12:05 T 2:25 R 12:05 R 2:25 Instructions: Answer all questions fully, showing work where necessary. 1) Let f ( n ) be the sum of the Frst n squares (i.e. f ( n ) = n i =1 n 2 ). Give a recursive deFnition of f . Let f (1) = 1, and for n > 1, let f ( n ) =
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: f ( n-1) + n 2 . 2) Give a recursive algorithm for Fnding the maximum of a Fnite set of in-tegers. input: a 1 , . . ., a n if n = 1 then m = a 1 else m = max( a 1 , . . . , a n-1 ) if a n > m then m := a n output m 1...
View Full Document

This note was uploaded on 08/11/2008 for the course MATH 240 taught by Professor Miller during the Fall '08 term at University of Wisconsin.

Ask a homework question - tutors are online