posted 8 years ago
Hello all,
I am trying to write a program that takes an array, effectively sorts the array with quickSort, then for each pair in the sorted array with a specified distance passed by reference (via the parameter in the method), it adds the difference to an ArrayList. The method effectively returns an ArrayList with integer pairs that are different. Please let me know if you need further clarification. For some reason, my code is returning an error in memory (in fact sometimes it does not even run). Now, from my understanding quicksort is the sort to use if the program does not use memory. However, if the program uses a substantial amount of memory, one should use Merge Sort. Please tell me where I'm going wrong. Thanks!
The error being generated comes from my main method where I initiate an improved for loop to print out Pairs from the declared arraylist. It is not running right now for example.