Quote:
Originally Posted by kaka123
hey im writing a program where i had a question about sorting an array..in my program i have to sort 3 arrays..does this mean i have to do the sort 3 different time and have 3 "dummy" arrays that will hold the values? i plan on using a interchange sort
My second question is that i need to Call a function that will return the most frequently occurring exam (scores from a [5][8] array) would i use an if statement to do this? there is 25 total scores in the array.thanks...hopefully i was not to vague on the questions
Hi kaka123!
Your first question is a little vague, but I think I can help a bit.
First of all, should the sortings of the arrays be independent or not? If they should, you'll have to sort every array separately (at least you have to call them separately at one point or the other). Else, you'll have to call them so they are connected in some way. (There are several ways for doing this, which one is best depends on your program.)
Now, depending on how you plan to sort your arrays exactly, you might need 3 dummy-arrays or you might not. I'm not quite sure how the "interchange sort" is supposed to work, I'm just guessing, you want to swap values within your array? If so, you'll only need one temporary value per array. (Or even one all together!) But it really depends on your algorithm.
My suggestion: Oost your sorting algorithm here (it doesn't have to be in Java yet, it could be pseudocode if you like) and we'll see, if and how it can be improved.
Concerning your second question, you can write such an algorithm with if-statements or (if the marks are saved with a primitive type) a switch-statement. I'd prefer the second one if possible, as I guess you have more than 2 different possible marks. ^^
Greetings,
Nepomuk