Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

arrays merge and sorting

 
kri shan
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Array1 has 3, 5,7 and array2 has 1,4,9 how to merger these two arrays as single array with elements are in sorting order.

Can i first sort the arrays individually an then merging or first merging the 2 arrays and then do sorting ?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12146
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can do it either way.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49432
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and it should be obvious which will give better performance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic