Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Your function should have a reference parameter for the array size that is updated when removing the duplicates. 7. Write a function that computes

c++ image text in transcribed
Your function should have a reference parameter for the array size that is updated when removing the duplicates. 7. Write a function that computes the average of the neighbors of a two-dimensional array element in the eight directions shown in Figure 12. double neighbor_average (int values [] [], int row, int column) However, if the element is located at the boundary of the array, only include the neighbors that are in the array. For example, if row and column are both O, there are only three neighbors. 8. Write a function vector int> append(vector a, vector int> b) that appends one vector after another. For example, if a is 149 16 and bis 974911 then append returns the vector 149 16 9 7 4 9 11 9. Write a function vector int> merge (vector a, vector int> b) that merges two vectors, alternating elements from both vectors. If one vector is shorter than the other, then alternate as long as you can and then append the remaining elements from the longer vector. For example, if a is 149 16 and bis 9 74 9 11 then merge returns the vector 1947 94 16 9 11 10. Write a function vector merge_sorted (vector a, vector b) that merges two sorted vectors, producing a new sorted vector. Keep an index into each vector, indicating how much of it has been processed already. Each time, append the smallest unprocessed element from either vector, then advance the index. For example, if a is 149 16 and bis 479 911 then merge_sorted returns the vector 144 79 9 9 11 16

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions