Write a computer program that prompts the user for a number

Assignment Help Programming Languages
Reference no: EM131290631

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: EM131290631

Questions Cloud

Write a program that calculate average of an unknown number : Write a program that will calculate and display the average of an unknown number of positive floating point values entered by a user.
Read the article and respond the below question : Tell me as much as you can about Augustine's mother and father based on the readings.Augustine tells you a story about stealing pears from a tree, but says that he didn't steal the pears because he wanted to eat them. Read the final pages of that f..
Fundamentals of effective communication in the workplace : Effective communication skills are essential in the workplace. Some businesses invest in training their employees on how to effectively communicate, because effective communication skills go beyond conversations.
Calculate the cash flow at maturity : The par value is $1,000 and the coupon payment is stated as 75% of the equity index return or zero. Calculate the cash flow at maturity assuming the equity index appreciates by 30% over this five-year period
Write a computer program that prompts the user for a number : 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.
Reduce the risk is to diversify the investments : One of the strategies to reduce the risk is to diversify the Investments. But it is also argued that diversification does not reduce Market risk. It may lead to a reduction in Unique risk. Do you agree with this argument? Defend your answer.
Explain the difference between market risk and credit risk : Identify why risk management can be beneficial to stockholders ? Explain the difference between market risk and credit risk. Are techniques for managing market risk appropriate for managing credit risk?
Provide a diagram illustrating the linux kernel architecture : You will provide a diagram illustrating the Linux kernel architecture and various components and classify it according to what we discussed in class.
Describe framework of general model of planned change : Describe the framework of the general model of planned change. Include a discussion of each activity and a typical sequence of events. What problems associated with planned change should the OD practitioner be aware of? How might such problems be ..

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