例如我們的輸入文件in.txt工作方式類似Unix的:算法排序
naturalistic 10
coppering 20
artless 30
命令後:排序in.txt
artless 30
coppering 20
naturalistic 10
命令後:排序-n -k 2 in.txt
naturalistic 10
coppering 20
artless 30
我的問題:如何根據列進行排序時如何管理保持行穩定。 我想整條線保持不變,而它的順序一般在變化? 什麼算法或代碼片是有用的?是關於文件閱讀還是分類設施?
+1對於同情但信息豐富和有幫助的答案。祝你們好運! – shellter