Home > Back-end >  String [] s and int [] c
String [] s and int [] c

Time:03-12

String [] s={" zhang ", "li si", "detective"};
20 s int [] c={}
The 20 year-old on behalf of zhang SAN, li si 18, fifty and 19
Now will they age smallest to and in accordance with the name: the age that the format of the output
This topic will be ordered age after the data element subscript changed, and the name of the original is not corresponding, zhang SAN's age is 20, before is now sorted zhang SAN is the age of 18, how to solve this problem, will sorted name is corresponding to the same

CodePudding user response:

First deposit corresponding map again

CodePudding user response:

Is there any other way, without a map, such as the use cycle and so on

CodePudding user response:

reference ~ 2 floor Commodity response:
is there any other way, without a map, such as the use cycle such as

You can use selection

CodePudding user response:

Selection sort, since the childhood, every time a [I] to the lowest value in a [n], and placed in a [I] in

reference 3 floor ~ Commodity response:
Quote: refer to the second floor ~ Commodity response:
is there any other way, without a map, such as the use cycle such as

Can use selection

CodePudding user response:

Selection is not as you think

CodePudding user response:

Name
reference 4 floor injured brain response:
selection sort, since the childhood, every time a [I] to the lowest value in a [n], and placed in a [I] in

Quote: refer to the third floor ~ Commodity response:
Quote: refer to the second floor ~ Commodity response:
is there any other way, without a map, such as the use cycle such as

You can use selection

But how after row of the sequence and corresponding output name

CodePudding user response:

The map so simple why don't have a map

CodePudding user response:

refer to fifth floor after brain injury response:
selection is not as much as you'd think

Is to use age selection sort, and then to name + age output, but the age after row of the sequence, the key is how to output the name + age such format?

CodePudding user response:

reference name 7th floor injured brain response:
map so simple why not map

Subject is a requirement for this

CodePudding user response:

Use TreeMap, add two arrays of successive which corresponds, TreeMap will, according to the key size is an array of Numbers to sort
  • Related