Finding top five number in an array of arraylists.
I have to write a method with a heading
publicstaticint [] findTopFiveMostSteps ( ArrayList [] temp )
i will input an array of arraylists, and I have to write this method
that will return a integer array containing the top five number in that
array of arraylists.
I have no idea how to go on about this
please help
How would you do it "manually"? That is, if you just had pencil and paper and several lists of numbers, what would be the steps? Keep them very simple and precise.
jverda at 2007-7-12 17:15:56 >

temp.subList(0, 5); // assuming top is 0Of course, if you want find the top 5 values, you could search thru the list to find what's larger than others.Maybe some sort of sorting thing...
> How would you do it "manually"? That is, if you just
> had pencil and paper and several lists of numbers,
> what would be the steps? Keep them very simple and
> precise.
Socrates would be so proud.
I was just reminiscing about how I once tried to teach Java to the web designer
at my last job. I gave him the task of writing:
static int max(int[] values)
He just didn't grok it:
Me: How would you figure it out by hand?
WD: I'd look at the numbers and pick the biggest.
Me: Break that down into steps.
WD: I'd -- look -- at -- the -- numbers -- and -- pick -- the -- biggest.
In the end, we tacitly agreed to stop the teaching and hope the manager didn't notice.