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

  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...

  Explain why competition synchronization is not a problem

Explain clearly why competition synchronization is not a problem in a programming environment that supports coroutines but not concurrency.

  Give the pseudocode for the enqueue

Show how to implement a queue using two stacks S1 and S2 so that the amortized cost of each operation on the queue is O(1).

  Develop a form using jsp that collects client body statistic

Develop a form using JavaScript that collects client body statistics and customer contact information for record keeping and marketing purposes.

  Create a program to compute car-s miles-per-gallon

Create a program which ask's the user for number of miles driven and gallons of gas used. It must compute the car's miles-per-gallon and show the result on the screen.

  What do you meant by abstract keyword

What does the abstract keyword do and what are generics as they relate to the built in linked list class? Why do we need them?

  Perl program that finds all the orfs in a genomic sequence

Given the genomic sequences for an organism; one of the first steps in identifying the genes is to identify the open reading frames - write a Perl program that finds all the ORFs in a genomic sequence.

  Write pseudocode for procedure construct-optimal-bst

Write pseudocode for procedure Construct-Optimal-BST (root) which, table root, outputs structure of the optimal bimary search tree.

  Output of the given program

Output of the given program - using namespace std - g^x = h mod p, find x. ex: 7^x = 15 mod 41, x = 3

  Write functions to do several types of string processing

Write functions to do several types of string processing. To test these you must write driver programs USING C++ without any errors and it has be executed properly.

  Write a prolog program to solve the sudoku puzzle

Write a Prolog program to solve the 6 by 6 Sudoku puzzle distributed in class. Do not use a solution downloaded from the Internet or elsewhere. Write your own. It should be designed along these lines: Label the squares X1, X2, ..., X36 as discuss..

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