Section2Key 2 - 5. One possj-ble public if solutj.on...

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 5. One possj-ble public if solutj.on appears below. int maxCount O { (size::0) t return 0; ) eLse { int max : L; int count = L; (int for i : L; i < size; i++) =: elementDatali (elementDatalil if count++i (count > max) { if max : counti ) ) else Count : 1; return max; ) solution appears below. - 1l) { ) 6. One possible public void mirror ( ) t intlast=2* size Li (int i - 0; i < size; for eLementData Ilast i] size *- 2; ) 7. One possible public if solution appears i++) - elementData lil ; below. void stretch(irrt n) { (n throw new fllegalArgumentException O; (int L; i >: O; i--) for i : size for(intj:0;j<n;j++) * n + jl : el-ementDatalil; elementDatali *: n; size ) 8. One possible public if solution appears beLow. int longestSortedSequence O{ (size :: 0) return 0; int max - L; : L; int current : t; i (int for i (elementData Ii] >:' elementData if current **; (current > max) if max : current; ) else : L; current recurn max; Ii 1] ) { I ...
View Full Document

Ask a homework question - tutors are online