« All Events
2:30 PM – Intro to Competitive Programming – Gamas
September 23, 2023 @ 2:30 pm - 3:30 pm
Homework
- Inside Sep23ArrayAndListIteration.java add codes to finish the following 2 methods
- printForwardEveryOtherElement
- findMin
- Create one new method printForwardToMiddleUsingList(List<Integer>). Redo method printForwardUpToMiddle(int[]) , but this time use List<Integer> instead of array.
- Create one new method swapFirstAndLast(int[] nums). This method will swap the first and last element of the list. No need to use for loop.
- Create a new method printForwardFromMiddle(int[] array). This will print elements inside an array from the middle element all the way to the end element.
- For example if an array has the following 0,1,2,3,4,5,6,7,8,9. Then calling this method will print 5,6,7,8,9.
- if an array has the following 0,1,2,3,4,5,6,7,8,9,10, then this method will print 5,6,7,8,9,10.