0

Sorting

Which is the best way to sort a word without using inbuilt sort method?

28th Oct 2017, 3:30 AM
Shamanth Rai
Shamanth Rai - avatar
2 Answers
+ 1
The best way is to implement Quicksort or Timsort yourself. The easiest way is probably Bubblesort or Selectionsort. (Google for "rosettacode bubblesort" or something) If you know that you are only dealing with lowercase letters for example you can make a better algorithm though (easier too).
28th Oct 2017, 4:16 AM
Schindlabua
Schindlabua - avatar
0
Maybe this will help :- String input = "computer"; char[] characters = input.toCharArray(); String output = new String(sorted_characters);
30th Oct 2017, 6:33 AM
Shekhar Raha