Elements of the arrays as the second parameter

Assignment Help Basic Computer Science
Reference no: EM132136886

***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

Reference no: EM132136886

Questions Cloud

Find minimal dfa for the languages : Find minimal dfa's for the following languages. In each case prove that the result is minimal.
How has technology affected workplace privacy : How has technology affected workplace privacy? What are the implications for the social contract between firms and their employees?
Restaurant management database project : Restaurant Management Database Project: The restaurant maintains the catalog for the list of food and beverage items that it provides.
More companies are embracing social customer care strategies : Define what Social Customer Care is and explain why more companies are embracing Social Customer Care Strategies.
Elements of the arrays as the second parameter : 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
Parameter size points to a variable : The extract function finds the positive numbers in the array a and store in array positive. The third parameter is array of positive numbers
Analyze and present the potential financial success : This report is primarily intended to analyze and present the potential financial success and profitability of Zivago Private Limited,
What challenges of community supervision does each case : Jonas has been placed on probation for indecent sexual behavior with a five-year-old boy.
Calculate the bandwidth of the circuit : Design a parallel resonant RLC circuit with 10 rad/s and Q = 20. Calculate the bandwidth of the circuit. Design a series RLC circuit with B = 20 rad/s

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Webflix maintains customer data in a 2d-array

WebFlix maintains customer data in a 2D-array called WF. Where the rows correspond to the customers and the columns correspond to films that it rents. An entry WF[i,j] indicates the number of times a customer has rented a film.WebFlix wants to find s..

  Please help with a function codesymbol

Please help with a function codeSymbol, to convert each mark to a symbol (A, B, C, D, E, F) and a code

  Malware protection on a network

What is the importance of windows server update services and windows defender when it comes to malware protection on a network.

  Write the rest of the program using assignment statements

Two variables named largest and smallest are declared for you. Use these variables to store the largest and smallest of the three integer values. You must decide what other variables you will need and initialize them if appropriate.

  Does the diagram meet all three levels of normalization

Does the diagram meet all three levels of normalization? (Patient: *PatientKey *Name *Address City State Zip) (Physician: *PhysicianKey *Name *Address City State Zip)

  Determine the largest angle that will cause the wedge

If the horizontal force P is removed, determine the largest angle that will cause the wedge to be self-locking regardless of the magnitude of force F applied to the handle.

  Idea of e-commerce was largely theoretical

Twenty years ago, the idea of e-commerce was largely theoretical. Ten years ago, social networking and cloud computing were in their infancy. Today, we cannot imagine the Internet without these things. Are there trends in computing today that are ..

  Find profits using just marginal revenue

For economics, how do you find profits using just marginal revenue, marginal costs, and fixed cost? Assuming that output increases by 1 each time.

  Calculations of a confidence interval still appropriate

Why are the calculations of a confidence interval still appropriate? According to the central limit theorem any distribution is considered normal.

  Ignore compliance mandates

What can happen to organizations and their senior management if they ignore compliance mandates?

  Transportation service for our clients

I am thinking of establishing a cleaning service that also provides food service for our clients including transportation service for our clients.

  Write an application that prints the following diamond shape

(Diamond Printing Program) Write an application that prints the following diamond shape. You may use output statements that print a single asterisk (*), a single space or a single newline character. Maximize your use of repetition (with nested for..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd