Question: I need these programs an Java for a dome program void set ( int idx, int val ) { / / Set the element located
I need these programs an Java for a dome program
void setint idx, int val
Set the element located at idx with the given value.
eg Suppose elements set changes it to
Do nothing if idx is invalid.
void addint idx, int val
Add the given element val at the given location idx
Assume that the given index is valid
Send the existing element to the end.
eg Suppose elements add will change it to
Make sure there are enough space for the new element.
void addint valArray
Add all the elements of the given array 'valArray' at the end of the array 'elements'.
Make sure there are enough empty space for the new array.
Calling enlarge once may not be enough. ensureCapacity will be more useful.
Integer max
Return the maxinum value among the existing elements.
Return null if empty
return null; This is here to avoid syntax error. Change if needed
int copyint start, int end
Return a new copy of the array between index 'start' and 'end' inclusive.
eg Suppose elements get returns a new array
Assume that both index start and end are valid.
If start end, then return the elements in reverse order.
eg Suppose elements get returns a new array
return null; This is here to avoid syntax error. Change if needed
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
