This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: F3(7); System.out.printf("exiting main\n"); } } Please turn over Exercise 2: Write a function countOccurrences that takes an integer array and an integer value and returns a count of the number of times the value occurs in the array. Exercise 3: Write a function incrValues that takes an integer array and increments the elements in the array in place (that is, do not allocate a new array). Exercise 4 (challenging): The ﬁle /home/amr/cs121/L5/Histogram.java contains the code we discussed in class today. The current implementation of genHistogram generates a histogram for the range [0. .high]. Modify it to generate a histogram for the range [lo. .high] where lo is an additional param-eter to genHistogram . Element histogram should hold the count of the number of elements in the array that equal lo (rather than as is now the case), histogram should hold a count of the number of elements equal to lo+1 , etc....
View Full Document
This note was uploaded on 10/10/2009 for the course CMSC 12100 taught by Professor Annerogers during the Fall '09 term at UChicago.
- Fall '09