Skip to content

Latest commit

 

History

History
31 lines (16 loc) · 1.53 KB

File metadata and controls

31 lines (16 loc) · 1.53 KB

Goal Sheet 10

Recursion and Sorting

Note: BJP = Building Java Programs (by Reges and Stepp)

Problem GS10-01 - Fibonacci (recursive)

Write a recursive method that takes an integer argument n and gives the nth number in the Fibonacci series. Your method that tests the recursive method (may use a loop) should display the series up through the nth number.

Problem GS10-02 - writeSquares

Write a recursive method called writeSquares that accepts an integer parameter n and prints the first n squares separated by commas, with the odd squares in descending order followed by the even squares in ascending order. For example, writeSquares(8); prints the following output:

49, 25, 9, 1, 4, 16, 36, 64 (BJP Ch 12 Ex 6)

Problem GS10-03 - Selection Sort (modified)

Write a modified version of the selection sort algorithm that selects the largest element each time and moves it to the end of the array, rather than selecting the smallest element and moving it to the beginning. Will this algorithm be faster than the standard selection sort? What will its complexity class (big-O) be? (BJP Ch 13 Ex 8)

Problem GS10-04 - Merge Sort (double)

Write a program that reads a series of input lines and sorts them into alphabetical order, ignoring the case of words. The program should use the merge sort algorithm so that it efficiently sorts even a large file. (BJP Ch 13 Proj 1)

Problem GS10-05 - APCS Labs (no points)

Finish APCS Labs

Problem GS10-06 - AP Free Response Practice

Start/continue free response practice problems.