Hi i have this for a practical tomorrow (C++): a) Write a function vector merge(vector a,...

50.1K

Verified Solution

Question

Programming

Hi i have this for a practical tomorrow (C++):

a) Write a function vector merge(vector a, vector b) that mergestwo vectors, alternating elements from both vectors. If one vectoris shorter than the other, then alternate as long as you can andthen append the remaining elements from the longer vector.

For example, if a is 1 4 9 16 and b is 9 7 4 9 11

Then merge returns the vector 1 9 4 7 9 4 16 9 11

b) Write a function vector merge_sorted(vector a, vector b) thatmerges two sorted vectors, producing a new sorted vector. Forexample, if a is 1 4 9 16 and b is 9 7 4 9 11 Then merge_sortedreturns the vector 1 4 4 7 9 9 9 11 16

c) Write a procedure void pie_chart(vector data) that displays apie chart of the values in data, assuming that all values in dataare positive.

d) Write the selection sort algorithm as a template function,which can sort both numeric and string data types.

Answer & Explanation Solved by verified expert
3.7 Ratings (405 Votes)
The language used is    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students