Computing the median of a set of sorted numbers

Assignment Help Applied Statistics
Reference no: EM132293841

Assignment - Statistics of a sorted data set in MARIE

This task will require you computing the median of a set of sorted numbers. We will break it down into small steps for you. Most of the tasks require you to write code and test cases. The code must contain comments, and you must submit it as .mas files together with the rest of your assignment. The test cases should also be working, self-contained MARIE assembly files.

1.1 Inputting a list of numbers

The first step is to input a set of numbers (number-by-number, using the Input instruction). You can assume that this will be a set of positive integers and that the last number given will be a zero. This means you can keep reading numbers until you receive a zero.

Setup code in MARIE which reads a set of positive integers and stores these as an array (contiguous block of memory). Do not include the 0 in the array; as you accept numbers you should keep track of the size and store this in a variable once all the reading is complete. Print the size of the array using the Output instruction to help you test that your program is correct.

1.2 List input subroutine

Extend your list input so that it can be used as a subroutine.

1.3 Checking t h e order

This part will require you to determining whether the given array is in order. Once you have an array of positive numbers, step through this array and store 1 in a variable inOrder where it is in ascending order or 0 otherwise. You should implement this as a subroutine which can be triggered once all the array values have been entered. You may like to display this variable for testing purposes.

1.4 Division by 2

Prepare a MARIE subroutine DIV which computes the quotient and remainder for dividing a number by 2. This can be done by the method of successive subtraction. The strategy is as follows:

1. accept a numerator N and divisor D

2. set quotient Q to zero

3. while N ≥ D...

  • increase Q by one
  • reduce N by D

4. N now holds the remainder and Q holds the quotient

1.5 Finding the Median

Once you know that the set of numbers are in order, find the middle value in the array to use as the median. Your DIV subroutine should help here. If there are two middle values (e.g. there are an even number of items) you should use the left of these as the median.

1.6 Complete Program

As a final step, combine all the previous subroutines into a program that does the following:

  • Let a user input a list of numbers using the subroutine from 2.2
  • Check whether or not that list is in order using your subroutine from 2.3
  • Find the median of this list of numbers using your subroutine from 2.5 (note this will also involve using your division by two subroutine from 2.4)
  • Output whether the list is in order (as a 0 or 1) and then the median if there is one

Files to be submitted:

1. Six MARIE files

2.1 InputtingList

2.2 InputtingListSubroutine

2.3 CheckingOrder

2.4 DivisionBy2

2.5 FindingMedian and

2.6 CompleteProgram

Reference no: EM132293841

Questions Cloud

Describe what you believe would be a day in the life : Describe what you believe would be a day in the life of one of these individuals. Examine whether this is a potential job for you. Why or why not?
Discuss the current business structure in detail : Submit a written profile on the company that you want to use for you marketing plan. Thoroughly describe the company's product line. Discuss their current.
Prepare an executive summary to accompany the report : Assume you work as a Research Analyst for McKinsey & Company. Your team recently completed a large research project on the status of data analytics.
Reflect on the categories of identity-based needs : Reflect on the categories of identity-based needs and think about how they relate to the conflict that you have selected.
Computing the median of a set of sorted numbers : Assignment - Statistics of a sorted data set in MARIE - This task will require you computing the median of a set of sorted numbers
Explain the target market : Explain the target market and the objective of the marketing campaign - Healthcare industry - Riverside Hospital in Virginia
How company will benefit by offering new product or service : This section should focus on providing a concise overview of your new product or service and how company will benefit by offering this new product or service.
Did you add value from your own professional : Did you provide several relevant references that helped make your points? Of course you can use the main MIT/Sloan case as a reference, but did you reach out.
What is the next step that should be taken in analyzing data : A researcher obtains an F value that is significant at the .01 level. What is the next step that should be taken in analyzing the data

Reviews

Write a Review

Applied Statistics Questions & Answers

  What the descriptive statistics tell us about the variable

Compute descriptive statistics for each variable along with an explanation of what the descriptive statistics tell us about the variable.

  1 suppose south korea can produce 100 computer chips with

1. suppose south korea can produce 100 computer chips with 10 hours of labor input and 50 bed linens with 6 hours of

  Are your independent variables truly independent

Statistical reasons and logic for why you selected the independent variables you selected. For each independent variable you must do the following: Are your independent variables truly independent? Is the proposed "Independent Variable" dependent o..

  What kind of experiment

What kind of experiment

  Conduct content coding to analyze qualitative data

Analysis of Quantitative and Qualitative Data - For Part 2 of this Assignment, you will conduct content coding to analyze qualitative data

  Explain the difference between nominal and ordinal data

Concepts and Terminology of Statistics Applied to Business Decision Making Projects. Explain the difference between nominal and ordinal data

  The probability a judge acquitting a randomly

A study revealed that the probability a judge acquitting a randomly chosen defendant was 0.17 while the probability that a jury would acquit a randomly chosen defendant was 0.33. Further, the probability that both a judge and a jury would have ..

  The webfile named airdelay

AirTran Airways and Southwest Airlines were among the leaders in on-time arrivals, with both having 88% of their flights arriving on time. But for the 12% of flights that were delayed, how many minutes were these flights late? Sample data showing the..

  Why did the authors use this t test

Why did the authors use this t test? Do you think it's the most appropriate choice? Why or why not? Did the authors display the data?

  Calculate the test statistic z

An article in a journal reports that 34% of American fathers take no responsibility for child care. A researcher claims that the figure is higher for fathers in the town of Littleton. A random sample of 234 fathers from Littleton yielded 96 who did n..

  Create a contingency table comparing the two variables

Create a contingency table comparing the two variables that you selected. In your own words, what was the purpose of the research study

  Which of sales invoices should be included in random sample

Determine which 50 of the 977 sales invoices should be included in the random sample. Note: There are many possible answers to this exercise.

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