What sorting to apply to words and numbers?

0 like 0 dislike
13 views
Symbols on the entrance is not more than 5000. The algorithms are not strong(temporarily) and need advice on what sort to use.

Example:
Input: car truck bus 8 -4 6 1 Output: bus car truck -4 1 6 8


Must preserve the order of numbers and words when sorting.
by | 13 views

1 Answer

0 like 0 dislike
We should also sort the words and numbers, noting the position of words and numbers in the input sequence, and then write them to the output in accordance with this order.

Sort is a built-in language feature, instead of writing their own, if this is not required by the problem statement.
by

Related questions

0 like 0 dislike
2 answers
asked Jun 1, 2019 by keddad
0 like 0 dislike
5 answers
0 like 0 dislike
1 answer
asked Jun 13, 2019 by megamage
0 like 0 dislike
1 answer
0 like 0 dislike
4 answers
110,608 questions
257,186 answers
0 comments
33,907 users