-1
用空格分隔字符串中的元素怎麼能sorted.I分離子有以下字符串:如何排序由空格字符串中的
temp = abcd bcda gfre dfgre fwft efwe
//temp.size() gives 30
//after the sort temp should look like ie temp = abcd bcda dfgre efwe fwft gfre
我需要在TEMP中元素進行排序儘可能少的時間。請注意,我正在處理的溫度的大小是10的權力7我忘了提及,我已經嘗試過的Collections.sort和Array.sort,它們比需要的時間要多得多。我需要的是比這更快的算法嗎?
好吧,你嘗試過什麼? (這裏有兩個或三個任務 - 拆分,排序和可能的加入...) –
將字符串拆分爲單詞,對單詞數組進行排序。 –
你對你想使用的排序算法有偏好嗎? – Brian