All Questions
11 questions
12
votes
3
answers
6k
views
Natural Order Comparator
I've been looking for an implementation of Comparator that provides a "natural order". I found a couple but they were buggy or poorly designed. I wrote my own with ...
2
votes
1
answer
9k
views
Sorting the array of strings on their lengths in Java , Using Maps, ascending order....
I wrote the java method to answer this question :
Write a Program to sort String on their length in Java? Your method should accept an array of String and return a sorted array based upon the length ...
3
votes
2
answers
462
views
Merge and sorting arrays of String and int in more efficient methods
Are there better methods for merge and sorting arrays of int and String in more efficient methods both time-complexity wise and ...
6
votes
3
answers
5k
views
Sorting a String based on its words
Is there a better, more efficient or nicer way to do this?
...
8
votes
2
answers
3k
views
String merge sort in Java
This snippet is about sorting a set of strings using merge sort. However, this version is tailored for strings as it relies on lcp values:
Given two strings \$A\$ ...
6
votes
3
answers
5k
views
Quicksort for strings in Java
I have this implementation of Quicksort for strings. The algorithm sorts the requested range by first character, then by second, third, and so on. (Please, do not confuse this with radix sort; it is ...
7
votes
2
answers
2k
views
Project Euler 22: Names scores
Description of challenge:
Using names.txt (right click and 'Save Link/Target As...'), a 46K text
file containing over five-thousand first names, begin by sorting it
into alphabetical order. Then ...
9
votes
4
answers
27k
views
Arranging words in sentences alphabetically
For an online contest whose problem is here, I wrote some code.
In this problem the input will consist of a number of lines of English text consisting of the letters of the English alphabet, the ...
10
votes
2
answers
41k
views
Count frequency of words in a given file
Write a function that takes two parameters:
a String representing a text document
an integer providing the number of items to return
Implement the ...
12
votes
4
answers
33k
views
Number aware string sorting with comparator
I have this class for use in sorting strings such that if strings have a number in the same position it will order the numbers in increasing order.
Alphabetical gives:
file1
file10
file2
What I'm ...
4
votes
3
answers
2k
views
Sorting strings in a one dimensional array
What are the better solutions possible?
I have a character array with different strings. There is a max size for the strings. In case a string is smaller than max size remaining places are filled ...