Write a function that takes two parameters

Assignment Help Computer Engineering
Reference no: EM132198925

Write a function called findMedian that takes two parameters - an array of int and the size of the array. The function should return the median of the array, which will require sorting the array.

This will change the original array, but that's okay for this assignment. If you are testing your code by calling it from a different file, remember to have a function prototype for findMedian in that file.

The file must be named: findMedian.cpp.

Also, Here is the example of Sort they would like us to use.

#include <algorithm> int main() { int array[] = {23, 5, -10, 0, 0, 321, 1, 2, 99, 30}; int size = 10; std::sort(array, array + size); for (int i = 0; i < size; i++) std::cout << array[i] << ' '; }

This program first initializes an array of ints. Next we use the built in sort function, which requires that you include <algorithm>.

It takes two arguments - a pointer to the start of the array, and a pointer to the end of the array (arrived at here through pointer arithmetic). Afterward, when the array is printed out, the elements will be in ascending numeric order.

Reference no: EM132198925

Questions Cloud

Management perspective for data-mining software project : Discuss the major risk management functions from a project management perspective for the data-mining software project.
Minimum average total cost curves : Companies can typically maximize their profits by operating at the minimum average total cost curves, independent of the economic environment.
What is the implied risk premium : Does uncovered interest parity hold in this example? If so, how do you know? If not, what is the implied risk premium? Which deposits pay a higher expected.
Demonstrate a function in scheme language : Write and fully demonstrate a function in "Scheme language" named super-duper, with this interface.
Write a function that takes two parameters : Write a function called findMedian that takes two parameters - an array of int and the size of the array.
Find all subgame nash equilibria of finitely repeated game : Find all of the game's pure-strategy Nash equilibria. Now suppose that the players play this game twice in a row. They observe what each other did in the first.
What is the situation of the private sector in each period : In 2009 country has a fiscal deficit of 4.2% of its GDP and it has a deficit in the external sector of 2.6% of its GDP.
Write a function called truncate : Write a function called truncate. It is passed 2 parameters, a float f and an integer d.
Is there an economic reason for this : Retailer companies sell many products for which manufacturers have a suggested retail price printed on the package.

Reviews

Write a Review

 

Computer Engineering Questions & Answers

  Find two ways to change the mac address on your computer

Perform a little research to find two ways to change the MAC address on your computer. Clearly explain why this is valuable knowledge to have.

  How much faster are heuristic methods based on lsh

How much faster are heuristic methods based on LSH than methods that guarantee the exact nearest neighbor, at what loss of accuracy?

  Design combinational circuit with three input and six output

Design a combinational circuit with three inputs and six outputs. The output binary num-ber should be the square of the input binary number.

  Define the differences among the computer forensic tools

Discuss some of the several backup tools available in the market. What are differences among the computer forensic tools?

  Are limitations of the study identified with recognition

Does the research deal with significant and meaningful problem that lends itself to a substantial research effort - Is it clear who or what will be aided

  Describe the pros of enabling auditing of resource accesses

Describe the pros and cons of enabling auditing of resource accesses. What is a virus? How can users and system administrators prevent virus infections?

  Determine the mean-square error for a uniform quantizer

[Uniform Quantizer Distortion] Determine the mean-square error for a uniform quantizer with 12 quantization levels, each of length 1, designed for a zero-mean.

  Explain each stage of the management plan

You have recently started your own software design company. You discover that your local DMV is looking to build a system that will allow receptionists.

  Determine the reinsurer frequency and severity distribution

A group life insurance policy has an accidental death rider. For ordinary deaths, the benefit is 10,000; however, for accidental deaths, the benefit is 20,000.

  Develop a design skills relevant to real time

Develop critical analysis and design skills relevant to real time, event driven autonomous systems; and Gain an understanding of the project life cycle.

  Draw data flow testing graphs for the program segment

Draw data flow testing graphs for the following program segment.

  Draw a uml class diagram that shows the relations

The bank supports the following transactions involving accounts belonging to the same customer: withdrawal, transfer, deposit.

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