Could you please help me out the java program to sort the characters for the given string without using sort() method? For example, if we are giving the input as "sai",the output should be "ais".
There is a vast amount of different sorting algorithms, bubblesort being the easiest and slowest, but works fine in a developing context.. Otherwise you've got selection sort, quicksort and heapsort to mention a few.
I want to know the logic behind sort() method.So that I asked this program without using sort(). Could you please tell me this progm using bubble sort method
I would say that Arrays.sort() always uses the same algorithm - it just has multiple implementations for different data types. It's a good algortihm, certainly, much faster than a bubble sort. But for a beginner it may well be easier to understand the bubble sort.
I would say that Arrays.sort() always uses the same algorithm - it just has multiple implementations for different data types. It's a good algortihm, certainly, much faster than a bubble sort. But for a beginner it may well be easier to understand the bubble sort.
Well, sort of.. I found Insertion sort (on smallest arrays), Mergesort (on Object arrays) and quicksort elsewhere. [ October 23, 2007: Message edited by: Jim Yingst ]
Sorry about the edit above - I accidentally hit edit rather than reply, but I was able to restore the original text.
Hm, OK. I would argue that using insertion sort for small arrays isn't based on the type of the array and overloading. But I didn't realize that both quicksort and heapsort were in there; thanks.
Post by:autobot
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
a bit of art, as a gift, that will fit in a stocking