Re: for loop and arrays !
Re: for loop and arrays !
Please be patient :) We're not online 24/7 constantly refreshing the page for questions to answer.
Here's a simple algorithm for sorting an array:
1. Start with index = 0
2. for every element indexed after index,
3. compare it with elements before index (going in order form 0...index).
4. At the first item that is "larger" than that value (according to the compareTo() method), the item at index needs to be inserted before that item
5. Repeat until index=length of items to be sorted
If you need help understanding the grammer/syntax of Java, this site should help you to understand the basic ways you can control the flow of your program: Java nuts and bolts: flow
Re: for loop and arrays !
Re: for loop and arrays !
See what you can do with helloworlds algorithm and post back if you get stuck