Write a computer program that prompts user for two numbers

Assignment Help Programming Languages
Reference no: EM13771929

Programming assignment: The purpose of the project is to perform a timing experiment. You are required to complete the following activities:

Write a computer program that prompts the user for a number, creates an array for that number of random integers, and then uses the sophisticated form of bubble sort to order the array. The program should print out the array prior to the call to the sorting algorithm and afterwards. You can write the program in either Java, C++, C#, or whatever language you are most comfortable in.

Repeat 1 but use insertion sort this time.

1 and 2 are primarily intended to make sure that your algorithms work.

Once you are convinced your programs work, do the following

Write a computer program that prompts the user for two numbers, n for the number of items in the array to sort, and num_ifor a number of iterations. Then do the following:

Initiate a variable running_time to 0

Create a for loop that iterates num_i times.

In the body of the loop,

Create an array of n random integers

Get the time and set this to start-time. You will have to figure out what the appropriate command is in the programming language you are using to find them time

Use sophisticated bubble sort to sort the array

Get the time and set this to end-time

Subtract end-time from start-time and add the result to running_time

Once the program has run, note

The number of items sorted

The number of iterations

The running time

Repeat the process nine times, using 5, 25 and 50 as the size of the array, and 10, 100 and 1000 as the number of iterations.

Repeat 3 using selection sort.

Create a spreadsheet showing the results of 3 and 4 and create a graph to graphically represent the information

Write a one page document explaining the results, bearing in mind that both algorithms have a complexity of O(n^2) and what you know about complexity analysis.

Reference no: EM13771929

Questions Cloud

Write paper on media involvement in west memphis case : Write a four pages paper about the media involvement in West Memphis Three Case.
What is the heat capacity of the bomb calorimeter : What is the heat capacity of the bomb calorimeter excluding the water -  What is the heat capacity of the bomb calorimeter excluding the water?
Write the output from instrument class methods : Write the output from your Instrument class methods to a text file that a user entered from the command line arguments (e.g. java Mynamep3tst myfilename.txt). This allows your program to accept filenames from the user via a command line argument.
How would you collect them for evidence : What are 2 actions that can be taken pertaining to the crowd of onlookers that might help you identify the offender(s)? Explain. How would you collect them for evidence
Write a computer program that prompts user for two numbers : Write a computer program that prompts the user for two numbers, n for the number of items in the array to sort, and num_ifor a number of iterations
What is the correct formula of the salt formed : What is the correct formula of the salt formed in the neutralization reaction of hydrochloric acid with calcium hydroxide and Select the compound in which sulfur has its highest possible oxidation number.
Determine the time of death : There is a difference between a crime scene investigator and a coroner's investigator. There is also a difference between a coroner and a medical examiner. There are 3 ways to determine the time of death
How can starbucks maintain its commitment to reducing waste : Control is achieved when behavior and work procedures conform to standards and goals are accomplished. By contrast, control loss occurs when behavior and work procedures do not conform to standards. To determine whether control is worthwhile, manager..
Find a recent osha violation in a healthcare setting : Using the internet, research and find a recent OSHA violation in a healthcare setting. Using your own writing, summarize the case in 1 or 2 paragraphs

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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