Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

***C PROGRAMMING***

Need help with a C program array_rearrange.c that rearranges an integer array. The array will be split into two sets of integers one by one. A new array will be created by append the first set to the second set. For example, an integer array {1, 2, 3, 4, 5, 6} will be split into two sets of integers: 1, 3, 5 and 2, 4, 6. Merging result: {2, 4, 6, 1, 3, 5}. Note that the two sets do not necessarily have the same length (when the array has even number of elements). When the input word has odd number of elements the first set will be one element more than the second set. For example, the result of rearranging an integer array {1, 2, 3, 4, 5} will be {2, 4, 1, 3, 5}. Your program should include the following function: void rearrange(int *a1, int n, int *a2); 

The function should use pointer arithmetic - not subscripting - to visit array elements. The rearrange function merges the two sets of integers by appending the first set to the second set and store the result in the second array a2. The function takes an int array parameters a1 and 2 as the first parameter and third parameters and the number of elements of the arrays as the second parameter.  

Example I/O:

Enter the length of the array: 5 

Enter the elements of the array: 9 8 5 6 4 

Output: 8 6 9 5 4

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93124351
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question why are the error terms in cross-sectional data

Question: Why are the error terms in cross-sectional data unlikely to be serially correlated? Can you give an example in which serial correlation could be present in a cross-sectional dataset? The response must be typed, ...

The american nursing association randomly selects 100 of

The American Nursing Association randomly selects 100 of its members from each state and invites them to participate in a survey about working conditions for hospital nurses in the United States. Which of the following i ...

Question part 1 answer below question with atleast 350

Question: Part 1: answer below question with atleast 350 words in APA format no plagrism and also I need two professional refrences 1) What is the power of scenario planning Part 2: answer below question with atleast 350 ...

This is a scilab question only and must be answered in

This is a SCILAB QUESTION ONLY AND MUST BE ANSWERED IN SCILAB LANGUAGE PLEASE or else I will not be able to understand, Please show every step, many thanks in advance!!! Consider the polynomial: Find the value q(x = 6), ...

Suppose a particular fa called fin has the property that it

Suppose a particular FA, called FIN has the property that it had only one final state that was not the start state. During the night, vandals come and switch the + sign with the - sign and reverse the direction of all th ...

Starting with this provided code add the following

Starting with this provided code, add the following functionality: Add the numbers 3 through 10 to the hashtable continuing in the same manner as shown. Prompt the user for a string, and display the corresponding number. ...

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Design a automatic room climate control system with

Design a automatic room climate control system with contextual model, state transition diagram.

Is smartart graphic and table slide important for

Is Smartart graphic and Table slide important for PowerPoint Presentation? How would it benefit?

A simple substitution cipher can be created by shifting a

A simple substitution cipher can be created by shifting a letter n positions in alphabetic order. For example, if the possible characters are the list [A...Za...z], a shift of three would translate A to D and Z to c. The ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As