Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
265 views
in Technique[技术] by (71.8m points)

Java: sorting a 2d String[][] matrix

I am writing a genetic algorithm and need to sort strings based on their fitness score. Both elements are saved in a single column, and two rows of an array like the following.

static String[][] guessArray = new String[2][popSize];

   guess:     | qwery | asdfg | 
   score:     |   4   |   2   | 

The above is a 2d array of strings that saves the guesses and their fitness scores. I need to sort both rows based on the scores in the bottom row. Previous posts have not answered this question (thank you to the mod for the link in my last post).

EDIT: Currently working on using an object and object array to do this. EDIT2: This doesn't mean that I have found a solution.

Many thanks!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...