How to Sort a 2D array?

后端 未结 4 571
面向向阳花
面向向阳花 2021-01-29 12:24

I need help with sorting 2D array. I\'ve got array with two rows

[5, 3, 4, 1, 2]
[10,20,30,40,50]

and I need to sort it to look like this:

4条回答
  •  自闭症患者
    2021-01-29 13:07

    Did you think about merge-sort-alorithm?

    http://en.wikipedia.org/wiki/Merge_sort that should be the fastest in that case. (an abstract implementation is available in wiki too)

提交回复
热议问题