First time posting here and I'm looking for a little bit of help. Basically what I need to do is develop an algorithm and than code it.
The situation is I need to create two array lists, one 30 numbers and the other 20 (the array lists are full of random numbers), and add them into one array in order from either lowest to highest, or highest to lowest. I can easily figure out what to do with the algorithm, and I know how to add them together, but the trouble I have is adding them in order from low/high or high/low.
I could easily just use the ArrayList add() method and than sort them, but my professor would like it to sort them as each individual number is added. I don't have any code ATM as I'm just looking for some guidance rather than the answer. Not gonna learn with just the answer. Any help is appreciated. I was looking towards using a for loop but not sure in what way.
Thanks for any help ahead of time