What sorting to apply to words and numbers?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
21 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 | 21 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 14, 2019 by megamage
0 like 0 dislike
1 answer
0 like 0 dislike
4 answers
110,608 questions
257,187 answers
0 comments
40,796 users