In statistics, when a set of values is sorted in ascending or descending order, its median is the middle value. If the set contains an even number of values, the median is the mean, or average, of the two middle values. Write a function that accepts as arguments the following:

a. An array of integers
b. An integer that indicates the number of elements in the array

The function should determine the median of the array. This value should be returned as a double. (Assume the values in the array are already sorted.) You’ll create two arrays: one with three elements (e.g. 1, 3, 7) and one with four elements (e.g. 2, 4, 5, 9).

Answers

Answer 1

The program is an illustration of methods

What are function?

Function are collections of named code blocks, that are executed when called or evoked.

The median function

The median function written in Python, where comments are used to explain each line is as follows:

#This defines the function

def medianValue(myList, n):

   #This determine the median element for odd list elements

   if n%2 == 1:

       medianElement = float(myList[int((n - 1)/2)])

   #This determine the median element for even list elements

   else:

       medianElement = (float(myList[int(n/2)]) + float(myList[int(n/2) - 1]))/2

   #This returns the median element

   return medianElement

Read more about functions at:

https://brainly.com/question/26180959


Related Questions

Please Convert This code into C program.............


public class PrintAllSubArrays {

public void printSubArrays(int [] arrA){

int arrSize = arrA.length;
//start point
for (int startPoint = 0; startPoint //group sizes
for (int grps = startPoint; grps <=arrSize ; grps++) {
//if start point = 1 then
//grp size = 1 , print 1
//grp size = 2, print 1 2
//grp size = 3, print 1 2 3 ans so on
for (int j = startPoint ; j < grps ; j++) {
System.out.print(arrA[j] + " ");
}
System.out.println();
}
}
}

public static void main(String[] args) {
int [] arrA = {1,2,3, 4};
new PrintAllSubArrays().printSubArrays(arrA);
}

}

Answers

Answer:

find the emoji challenge

Explanation:

1234

Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. The output of the program is every word in the list that contains the character at least once. For coding simplicity, follow each output word by a comma, even the last one. Add a newline to the end of the last output. Assume at least one word in the list will contain the given character. Assume that the list of words will always contain fewer than 20 words.

Answers

The program is an illustration of lists

What are lists?

Lists are variables that are used to hold multiple values

The main program

The program written in Python, where comments are used to explain each line is as follows:

#This gets the integer

n = int(input())

#This gets the character

char = input()[0]

#This creates an empty list

MyList = []

#This following loop gets input for the list

for i in range(n):

   MyList.append(input())

#This iterates through the list    

for items in MyList:

   #This checks if the character is in a list element

   if char in items:

       #If yes, the element is printed

       print(items,end =", ")

Read more about lists at:

https://brainly.com/question/24833629

write a program to input a number and print the largest and smallest number using c++.
please help fast​

Answers

Answer:

#include<stdio.h>

#include<limits.h>

void main()

{

int min,max,i,n,num;

min = INT_MAX;

max = INT_MIN;

 

printf("How many numbers do you want to enter: ");

scanf("%d",&n);

 

for(i=0; i<n; i++)

{

 printf("Number-%d: ",i+1);

 scanf("%d",&num);

 if(num>max) max = num;

 if(num<min) min = num;

}

 

printf("Smallest number = %d\nLargest number = %d",min,max);

}

Explanation:

The web is based on the ____ Protocol?

Answers

Answer:

blank

Explanation:

that question answer is the web is based on the blank protocol

Answer:

The web is based on the HTTP protocol

Pls pls answer
I will mark the Brainlyest

Answers

Answer:

Recipient

Explanation:

The recipient is the person that the email is sent to.

Complete the steps for scheduling a meeting.
1. Open a new Meeting window.
2. Enter attendees in the
box.
3. Click Scheduling Assistant.
4. Select
5. Check free/busy time.
6. Click

Answers

Answer:

To, Attendees, Send

Explanation:

Just did it.

Explain how interactions between characters develop one of the themes in Cheboygan Day? Explain

Answers

The Cheboygan Daily Tribune is a daily newspaper published Tuesdays through Saturdays in Cheboygan, Michigan, United States. It is owned by Gannett. In addition to the daily newspaper, Gannett also publishes the Shopper's Fair pennysaver and Mackinac Journal, the "magazine of the straits".

why are women more exposed to mass media?

Answers

Women are more exposed to mass media because their voice is of high frequency which is clear to listen to, and it's soothing and people think it is a safer app or knowledge than that provided by males.

What is mass media?

Mass media is the media responsible for broadcasting or speaking information that reaches a large number or audience. It includes radio, advertisement, movies, magazines, T.V, etc.

Women are more exposed to these mass media because of their voice, which is said to be soothing, and more generous. Their voice is technology friendly.

Thus, due to the fact that women's voices have a higher frequency, are easier to hear, are calming, and are perceived as offering a safer source of information than men's, they are more exposed to the media.

To learn more about mass media, refer to the link:

https://brainly.com/question/14974921

#SPJ2

How to add text on picture? Write the steps.​

Answers

Answer:

Here r ur steps :-

Explanation:

Download any editing application from Play Store.( nowadays these features come pre installed in ur gallery )

Then open it and tap on add text option.

And then add ur text.

Hope it helps .

Stay safe, stay healthy and blessed.

Have a great day !

Thank you

Basically you just go on the insert tab, in the text group, click text box, drag to draw a text box anywhere near the picture, and then type your text. to change the font or style of the text, highlight the text, right-click it, and then select the text formatting you want on the shortcut menu.


hopefully that helped.

Map-reduce Java code for Matrix Multiplication. It should be unique not copied from Internet

Answers

Answer:

that is an example of matrix

Consider the following code segment.

int[] arr = {1, 2, 3, 4, 5, 6, 7};
for (int i = 1; i < arr.length; i += 2) {
arr[i] arr[i - 1];
}

Required:
What represents the contents of the array arr after the code segment is executed?

Answers

The contents of the array "arr" after the code segment is executed is [1, 1, 3, 3, 5, 5, 7].

What is an array?

An array can be defined as a set of memory locations or data structure on a computer system that comprises a single item of data with each memory location sharing the same name.

This ultimately implies that, the data (elements) contained in an array are all of the same data type such as:

StringsIntegers

From the source code, the array's length is equal to 7. Also, the first iteration of the loop (i = 1) produces the second index of the array and its elements are updated with the previous value.

In conclusion, the contents of the array "arr" after the code segment is executed is [1, 1, 3, 3, 5, 5, 7].

Read more on array here: https://brainly.com/question/19634243

6.9 How is it possible for one computer with a low MIPS rating to have a better performance in practice than a computer with a high MIPS rating

Answers

The performance of systems differs. Computers with low MIPS rating to better performance then high MIPS rating  is explained below:

What is the The performance of a system about?

The Millions Instructions per Seconds (MIPS) is said to give the accurate measurements for the speed and work output of computer systems.

One computer with a low MIPS rating  often supports register-to-register operations but computer with a high MIPS rating that is complex set of instruction supports memory-to-memory operations.

Though the two systems can be similar in terms of hardware, Instruction Set Architecture (ISA) and software, the MIPS rating often differs

The performance of a system can be measured based on the amount of the time taken to perform a task and so therefore, the lower the MIPs, the   better performance in practice.

The MIPS is seen as not a good factor to show the performance of a system because not all instructions does the same amount of computation.

Example is When there is a type A processor that is known to have a MIPS rating of 1,000 (high MIPS rating ), and a type B processor that also have an MIPS rating of 500 ( low MIPS rating ).

The type A processor do appears twice as fast as the type B processor but the low MIPS rating option will operating at only half the number of MIPS and as such is faster than high MIPS rating.

Learn more about computer from

https://brainly.com/question/24540334

Select the correct answer.
What is the advantage of using external JS and CSS files?

Answers

Answer:

B

Explanation:

A conditional expression is also known as what?
a) Switch Statement
b) Alternative to if-else
c) If-then-else statement
d) Immediate if​

Answers

Answer:

An if-then-else statement

Explanation:

Answer:
C
Conditionssss

lets do something new​

Answers

Do I hav to subscribe ?

Stay safe, stay healthy and blessed.

Have a great day !

Thank you

i'll subscribe if you will say :-)

the example of flash drive?​

Answers

Answer:

A data storage device

Explanation:

A data storage device that uses flash memory. ... The definition of a flash drive is a small, rewriteable data storage device that connects to a computer with a USB port. An example of a flash drive is a small memory stick that is kept on a keychain.

Question 4 of 10
Which computer discipline involves designing technologies such as
smartphone apps and the operating systems that run computers?
A. Information technology
B. Software engineering
C. Information systems
D. Computer engineering
SUBMIT

Answers

Answer:

B. Software engineering

Answer:

B. Software engineering

Explanation:

what are the main technologies that have contributed to be growth and commercialization of the Internet

Answers

hope it helps have a good day

A strong west wind is keeping the sea breeze from moving onto Florida’s eastern
shore. How will this wind affect storm activity?
A. It will keep it offshore.
B. It will push it south.
C. It will allow it to move west.
D. It will not allow storms to form

Answers

There are different rates of temperature. The wind affect storm activity as It will allow it to move west.

What is the relationship of the sea and land breeze to the temperature?

It is better to note that the higher the temperature differences between land and sea, the much stronger the land breezes and sea breezes will become.

The Storm surges happens when strong winds push high amounts of water onto land. The Stronger west winds can hinder the sea breeze front from going onshore. Hurricanes do move from east to west.

The average hurricane moves from east to west

learn more about wind from

https://brainly.com/question/392723

Many keyboard shortcuts, such as Ctrl+C, Ctrl+X, and Ctrl+V, are universal, and can be used in a wide variety of applications.
A True
B) False

Answers

Answer: A) True

Explanation:

According to Goog|e, "Keyboard shortcuts are also universal—meaning once you learn them, you can use many of the same shortcuts in a variety of applications. For example, you can use the shortcuts that copy and paste text in a word processor application to perform the same tasks in emails, blogs, or other applications."

I hope this helps!

Type the correct answer in the box.
What is the output of the formula
=NOT(12+12=24)?“
The output of the formula =NOT(12+12=24) is

Answers

Answer:

(24=24)

.............

What microphone is this

Answers

Answer:

Thats looks like a Sennheiser Pro Audio Wireless Microphone System, Black (MKE600) .  also known as Sennheiser MKE 600

Where you can get it:

https://www.amazon.com/Sennheiser-MKE600-Camcorder-Shotgun-Microphone/dp/B00B0YPAYQ

Youre welcome. (pls give brainlest thanks)

Anyone know why my desktop won’t turn on, I upgraded my ram and my monitor won’t turn on

Answers

Answer:

RAM Slots

Explanation:

RAM is most probably in the wrong slots.

Check BIOS

Check with Motherboard User Manual.

Chad, a computer programming student, just finished writing a computer program. In order to check whether the program performs the intended task, Chad must convert the source code to an program. Which tool would Chad need for this purpose?

Answers

Answer:

A compiler, Brainiest please

Which three nodes are included in the response from the Text Moderation API?

Select all answers that apply.

1. Terms

2. IsImageAdultClassified

3. Classification

4. ReviewerResultTags

5. Expression

6. PII

Answers

Answer:

isimageadultclassified, classification and Reviewerresulttags

computer network reduce the cost true or false​

Answers

True... computer network reduces cost

Which step of the problem-solving process did the farmer use in order to figure out what success would look like?

Answers

Answer:

supply and demand

Explanation:

As a farmer you rely on demand of food therefore when the market demands you supply and make profit for example during a particular season lets say grapes demand is high so you grow grapes inorder to supply and make profit therefore implementing this strategy the farmer can succeed.

Discuss operator precedence in C programming with examples ​

Answers

Answer:

See picture for the operator precedence.

A very common pitfall is the << (shift) operator.

It has lower precedence than, for instance, the + operator, so a statement like:

int a = 3;

int c = a << 2 + 1;

will produce a different result than:

int c = (a << 2) + 1;

The first will evaluate to c = a<<3.

If the programmer translates the following pseudocode to an actual programming language, a syntax error is likely to occur. Can you find the error?

Declare String 1stPrize
Display "Enter the award for first prize." Input 1stPrize
Display "The first prize winner will receive ", 1stPrize

Answers

Answer:

if, then, else

Explanation:

you specified that if you enter award for 1st prize then it'll display 1st prize but you didnt specify what will happen if user does not enter 1st prize or what happens if 1st prize is not allocated. To me it looks like you got the 'if' and 'then' part correct but you dont have a 'else' part to it therefore it'll create an error when its not declared.

Answer:

begins with a number

Explanation:

The first character of the variable name begins with a number. This is an error because most programming languages do not allow variable names to begin with numbers

In computer science, what does it mean to interface?
A. To know the history of computing and computer science
B. To be able to personally show others how to use a computer
C. To know how to use materials and tools to build a computer
D. To communicate with a computer through a device or program

Answers

D, To communicate with a computer through a device or program :)

Other Questions
The longer leg of a right triangle is 4 inches longer than the shorter leg. The hypotenuse is 8 inches longer than the shorter leg. Find the side lengths of thetriangle. Explain how a commitment to a decision could assist a school leavers to adapt to the change of entrepreneurship help how was tallulah falls formed? Just need help with the problems that have Xs next to them. In this figure, 12.2% of the area is painted blue.How much of the area is painted blue?4 cm1.22 cm?O 3.05 cmO 4.27 cm5 cmO 5.49 cm5 cm PLEASE HELP ME? Oscar bought a circular cover for his backyard spa with an area of 48 square feet. How can Oscar best determine the radius of the spa cover? A Divide 48 by , then take the square root of the quotient. B Take the square root of 48, then divide the quotient by T. C Multiply 48 byt, then multiply the product by itself. D Take the square root of 48. Plzzzzzz help meeeeee I will mark brainiest for correct answers!1 Studying a picture of a cell taken with a microscope, you find that the cell has a nucleus, cell wall, and plastids. You conclude that the cell is probably a(n) _____ cell.A) animalB) plantC) prokaryoticD) eukaryotic2 Studying a picture of a cell taken with a microscope, you find that the cell has no nucleus and no mitochondria, but does have a cell membrane and a cell wall. You conclude that the cell is probably a(n) ____ cell.A) animalB) plantC) prokaryoticD) eukaryotic Select the three prepositional phrases.-According to world-renowned surfer Carissa Moore, the Mentawai Islands in Indonesiaoffer some of the planet's most challenging waves. What NEVER happens while a mixture is being separated? The chart below identifies a variety of acts performed by citizens.Pay taxesObey the lawServe on a jury if summonedRegister with the Selective ServiceWhich phrase provides the best title for this chart?The Privileges of CitizensThe Responsibilities of CitizensO O O oThe Obligations of CitizensThe Rights of Citizens The graph of y = x2 4 is shown... What are the solutions to x2 4 = 0? According to the pluralist theory of government, ________. Read the poem.The Whippoorwillby Madison Julius CaweinI. Above lone woodland ways that led To dells the stealthy twilights tread The west was hot geranium red; And still, and still, Along old lanes the locusts sow With clustered pearls the Maytimes know, Deep in the crimson afterglow, We heard the homeward cattle low, And then the far-off, far-off woe Of "whippoorwill!" of "whippoorwill!"II. Beneath the idle beechen boughs We heard the far bells of the cows Come slowly jangling towards the house; And still, and still, Beyond the light that would not die Out of the scarlet-haunted sky; Beyond the evening-star's white eye Of glittering chalcedony, Drained out of dusk the plaintive cry Of "whippoorwill," of "whippoorwill."III. And in the city oft, when swims The pale moon o'er the smoke that dims Its disc, I dream of wildwood limbs; And still, and still, I seem to hear, where shadows grope Mid ferns and flowers that dewdrops rope, Lost in faint deeps of heliotrope Above the clover-sweetened slope, Retreat, despairing, past all hope, The whippoorwill, the whippoorwill.Whippoorwill - a nocturnal bird with a distinctive call that is suggestive of its nameQuestion 1Part AWhat is a theme of The Whippoorwill"?Certain sounds can transport people back in time.People have lost their connection to nature.People who live in cities do not miss nature.Some people do not appreciate nature.Question 2Part BHow does the theme in Part A develop in the poem?Living in the city, the speaker reminisces about the country and the sound of the whippoorwill.Coming home in the evenings, the speaker hears the whippoorwill.Dusk is set to the music of lowing cattle and the whippoorwill.The countryside is full of natural sounds such as lowing cattle and the whippoorwill. Scenario A. Luna is a manufacturer of fashion jewelry. The company has been operating for the past decade and is well known. When the CEO, Aimee, was asked by a local newspaper during an interview about the secret to her success, she stated that there were several reasons. She makes sure that the company always introduces new styles of jewelry to suit changes in tastes and stay a step ahead of her competitors, and the company offers its customers the best by using fine-quality semiprecious stones in artful settings. She also stated that the company's salespersons cater to customers individually to help them purchase jewelry appropriate for their personal style. Luna has its own exclusive website, which can be accessed anywhere in the world, and customers are promised that they will get what they order within 36 hours. From Scenario A, it can be understood that Aimee is an example of a(n) Select one: a. strategic manager. b. frontline manager. c. operational manager. d. tactical manager. e. middle-level manager. If one card is drawn from a deck, find the probability of drawing a 4 or a spade,Express your answer as a fraction, reduced to lowest terms, The instructions States inhale 1 to 2 MDI Puffs 90 to 180 mcg every 4 to 6 hours how many mcg are needed to fill this prescription per day The conclusion of an argumentative essaydoes not need to repeat the topic.restates the claim and why it is important.ignores counterclaims and the opposing view point.addresses any other idea not previously discussed. *Will award brainliest if correct answer is given!*DVT is a serious condition of clots in the deep veins of the ______ and pelvic areas.a. femoralb. poplitealc. coronaryd. peripheral Endurance allows for peak performances over long periods of time. Please select the best answer from the choices provided. T F.