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

  Explain a functioning design in unity game engine

Need a functioning design in Unity Game Engine. The rough draft only needs the game level scene, skybox, the terrain (shaped, textured, with trees and grass), the buildings (with functioning doors), the avatar, and being able to "pick up" the two ..

  Write program to read data of four students from input file

Write C++ program which reads data of 4 students from the input file which name is given by user and displays summary report of students' marks on output file stdMarks.out"

  Design recursive program to generate random blurbs

A Whoozit is the character 'x' followed by zero or more 'y's. A Whatzit is a 'q' followed by either a 'z' or a 'd', followed by a Whoozit. Design and implement a recursive program that generates random Blurbs in this alien language.

  Create application consisted of three classes

Create an application comprised of three classes. The first class called Crayon represents one crayon of a particular color and length (height).

  Create class polynomial is array of terms

Create the class Polynomial. Internal representation of the Polynomial is the array of terms. Each term contains the coefficient and the exponent.

  Clear description of the program you are building

Your final project will be to analyze, design, and document a simple program that utilizes a good design process and incorporates sequential, selection and repetitive programming statements as well as function and subprogram calls and uses arrays...

  Implement a program that processes an input file

Implement a program that processes an input file by changing every occurrence of an old string into a new string. (e.g., the usage is: chstr.pl file oldstring newstring, chstr.pl is your program name, file, oldstring and newstring are parameters ..

  This laboratory gives practice in the creation and use of

this laboratory provides practice in the creation and use of basic and advanced sql queries involving more than one

  Write program to prompt for and accept current salary

Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases.

  Draw application to display button and label on a screen

Draw and implement application which displays a button and a label on a screen. Every time button is pushed, the label will display random number between 1 and 1000,

  Application to feature a gui

A program written in Dr. Racket Scheme that makes use of lists, higher order procedures (e.g. map, filter, reduce) and/or recursion. If all of those could be used it would be best

  A slip class file with indicated methods defined

A customer Class file with indicated Methods defined - A boat Class file with indicated Methods defined and a slip Class file with indicated Methods defined.

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