[C++-sig] help with this program

Epo Dada epo011 at yahoo.com
Tue Apr 2 21:57:23 CEST 2002


Write a function

vector<int> merge_sorted(vector<int> a, vector<int> b)

that merges two sorted arrays, producing a new sorted
array. Keep an index into each array, indicating how
much of it has been processed already. Each time,
append the smallest unprocessed element from either
array, then advance to the next index. For example, if
a is

1   4   9   16

and b is

4   7   9   9   11

then merge_sorted returns the array (vector)

1   4   4   7   9   9   9   11   


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://http://taxes.yahoo.com/




More information about the Cplusplus-sig mailing list