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

  Write program to calculate pay of different types of employe

Write program to calculate pay of different types of employe

  What would the result of the syntax

What would the result of the syntax.

  Program to determine weighted average of test

Write an algorithm for a program which prompts the user to enter the five test scores, determine total of the five tests and determine the weighted average of each test supposing that each test weighs 20%.

  Explain the x-net mesh interconnect built into the mp-one

Explain the X-Net mesh interconnect (the PE array) built into the MP-1. Explain the computing granularity on PEs and how fast I/O is performed on the MP-1.

  What can be done to enhance the security of business uses

question 1 what can be done to improve the security of business uses of the internet? give several examples of security

  Determine the purpose of multiplexing in brief describe

question 1 which layers of the network model are specifically concerned with communication channel media and signaling

  Write a script using vim editor

Write a script using vim editor. The script should display the path to your homedirectory and the terminal type that you are using.

  Explain time and space complexity in details

What do you mean by performance of algorithm explain time and space complexity in details?

  Create a program that calculates and print the take-home pay

Create a program that calculates and prints the take-home pay for a commissioned sales employee. Allow the user to enter values for the name of the employee.

  Explain the difference between the http actions get and post

Explain the difference between the HTTP actions GET and POST. Which is more vulnerable to SQL injections? Provide an example to support your statement.

  Write down a paper comprising of 500-1000 words

write a paper consisting of 500-1000 words double-spaced on the security effects of cryptographic tunneling based on an

  Write the relational schema draw its dependency diagram and

a. write the relational schema draw its dependency diagram and identify all dependencies including all partial and

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