Implement an interleave function which combines two integer arrays into a new dynamic array. The term interleave means to alternatively insert the values of two arrays into a single array. For example, given these two arrays as input: Array A: 95 92 27 98 76 Array B: 40 96 This function will return the following dynamic array: 95 40 92 96 27 98 76 The algorithm should work with arrays of same or different size. All array indexing must be done using pointer arithmetic. int* interleave (int *a, int *b int s1, int s2) {

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 29SA
icon
Related questions
Question
Implement an interleave function which combines two integer arrays into a
new dynamic array. The term interleave means to alternatively insert the
values of two arrays into a single array.
For example, given these two arrays as input:
Array A: 95 92 27 98 76
Array B: 40 96
This function will return the following dynamic array:
95 40 92 96 27 98 76
The algorithm should work with arrays of same or different size.
All array indexing must be done using pointer arithmetic.
int* interleave (int *a, int *b int s1, int s2) {
Transcribed Image Text:Implement an interleave function which combines two integer arrays into a new dynamic array. The term interleave means to alternatively insert the values of two arrays into a single array. For example, given these two arrays as input: Array A: 95 92 27 98 76 Array B: 40 96 This function will return the following dynamic array: 95 40 92 96 27 98 76 The algorithm should work with arrays of same or different size. All array indexing must be done using pointer arithmetic. int* interleave (int *a, int *b int s1, int s2) {
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning