Sorting algorithms in c# and java.