Sort?

Hi all~It may be stupid to ask but I am totally new to this java programming...i will be thankful if any kind soul can help me out on this :How do i implement new algorithms in java, using MergeSort and SelectSort as examples?thank you very much!!!
[283 byte] By [j3boXa] at [2007-9-29 20:56:33]
# 1

you can create a class with methods that get an array as a parameter, sort it and return a new sorted array or just the original one.

class Sort {

public void MergeSort(Object array[]) {

// orders the array

}

public void SelectionSort(Object array[]) {

// orders...

}

}

with these methods you can order any kind of array (but the object contained should implements the Comparable interface).

if you need the algorithm for MergeSort etc you can do a web search. you may find these algorithms in another language but you shouldn't find it hard to translate them in Java :-)

recoil_a at 2007-7-16 1:06:07 > top of Java-index,Other Topics,Algorithms...