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.:- M93118060
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Computer architecture amp operating systems assessment -

Computer Architecture & Operating Systems Assessment - Computer Architecture Assignment Learning Outcomes - a) Understand how to evaluate the performance of a computer system. b) Understand the five classic components of ...

Advertisements suggest that a new window design can save

Advertisements suggest that a new window design can save $400 per year in energy cost over its 30-year life. At an initial cost of $8,000 and zero salvage value, using IRR, is this window a good investment? MARR is 8%.

Need help with a java program that takes two arrays a and b

Need help with a Java program that takes two arrays a and b of length 5 storing int values, and returns the dot product of a and b. That is, it returns an array c of length n such that c[i]=a[i]*b[i].

Taskwrite a cc program to emulate a simple calculator that

Task Write a C/C++ program to emulate a simple calculator that can calculate and display the results of performing one of the following arithmetic operations between two integer numbers (+, -, *, /). The Calculator progr ...

Question suppose that you are working with gps data from an

Question : Suppose that you are working with GPS data from an Excel spreadsheet and that you map it in ArcMap. However, you are surprised that the data points are in Australia instead of Chile? What could be the possible ...

Should we be renegotiating nafta yes or no if it is

Should we be renegotiating NAFTA? yes or no? If it is renegotiated, should it be replaced? What reasons would make it better in your point of view? What is the best argument you can make why NAFTA should or should not be ...

A farm has two types of trees 30 are orange trees o and 70

A farm has two types of trees: 30% are orange trees (O) and 70% are apple trees (A). Frost (F) has damaged 40% of the orange trees (F|O)=0.4 and 10% of apple trees. What is the probability that a randomly selected tree w ...

Wildhorse inc has outstanding bonds that will mature in six

Wildhorse, Inc., has outstanding bonds that will mature in six years and pay an 8 percent coupon semiannually. If you paid $1,009.52 today and your required rate of return was 7.0 percent.  (Round intermediate calculatio ...

List the common development failures and errors that

List the common development failures and errors that results from poor software security efforts

Select two application areas for data mining not discussed

Select two application areas for data mining NOT discussed in the text book and briefly discuss how data mining is being used to solve a problem (or to explore an opportunity)?

  • 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