#ArrayList assignment
1 messages · Page 1 of 1 (latest)
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
how should i start?
write code that prints all values of an array
then put that example array in there
then write the stub for the method ur supposed to write
and then u will do binary search to find the insertion point
and then insert there
step by step
for adding at a specific index, u can use this method:
https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/util/List.html#add(int,E)
declaration: module: java.base, package: java.util, interface: List
binary search also already exists Collections.binarySearch(...). but i guess ur supposed to write it urself (?)
public static void printArray(int[] array) {
for (int i = 0; i < array.length; i++) {
System.out.println(array[i]);
}
}
good. now write a main method, put the example array from the task there and print it
with that, u can later verify that ur code works
oh okay thanks
Closed the thread due to inactivity.
If your question was not resolved yet, feel free to just post a message to reopen it, or create a new thread. But try to improve the quality of your question to make it easier to help you 👍