A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
arrays merge and sorting
Joined: Apr 08, 2004
Mar 10, 2011 16:19:29
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 ?
Joined: Oct 02, 2003
Mar 10, 2011 17:06:32
you can do it either way.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Oct 13, 2005
Mar 11, 2011 03:18:13
. . . and it should be obvious which will give better performance.
I agree. Here's the link:
subject: arrays merge and sorting
Sorting elements by associated integers.
sorting of elements in an array
Recursion and MergeSort : How is it working ?
about adding two arrays
Vector operation implementation why JDK preferred arrays over linkedlist
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014