RecBiggest

RecBiggest - return biggest(number, number.length-1); }...

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

View Full Document Right Arrow Icon
public class RecBiggest{ public static void main(String[] args){ int [] nums = new int[] {4,2,6,3}; System.out.println(biggest(nums)); nums = new int[] {4,2,6,7}; System.out.println(biggest(nums)); nums = new int[] {4,2,1,3}; System.out.println(biggest(nums)); } public static int biggest(int[] number){
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: return biggest(number, number.length-1); } public static int biggest(int[ ] number, int end){ if(end == 0){ return number[0]; } else { int restBig = biggest(number, end-1); if (number[end] > restBig){ return number[end]; } else { return restBig;} } } }...
View Full Document

This note was uploaded on 07/12/2009 for the course CS 111 taught by Professor Hari during the Fall '08 term at Rutgers.

Ask a homework question - tutors are online