Produce a program that sorts a list of numbers in ascending

Assignment Help Computer Engineering
Reference no: EM132217499

Written in Java

Your job is to produce a program that sorts a list of numbers in ascending order. Your program will need to read-in, from a file, a list of integers - at which point you should allow the user an option to choose to sort the numbers in ascending order via one of the three Sorting algorithms that we have explored. Your program should use the concept of Polymorphism to provide this sorting feature. As output, you will display the sorted list back to the user.

A secondary task of this assignment is to provide runtime analysis of your program. As discussed in lecture, Big-O notation provides us a way to evaluate the performance of our code. You will provide in a separate text file the Big-O of the two sorting algorithms that we have implemented in this assignment.

This program will be written in Java.

Your program will be menu driven in which you will provide the following prompts to the user:

1. Load Integers (From File)

2. Exit Program

Once the user has loaded the list of integers the following options should be provided:

1. Insertion Sort

2. Bubble Sort

3. Exit Program

The text file containing integer data will be provided to you. The filename will be data.txt - this file can be found (and downloaded) on Canvas. The file will contain fifty integers (50) and they will be comma separated on a single line.

Example:

39,14,100,16,93,24,62,68,52,76,86,48,15,41,83,55,18,30,74,7,31,44,67,81

Your program must contain at-least four (4) classes.

o Driver

o Sort

o Insertion Sort

o Bubble Sort

o Quick Sort

You must use the concepts of Inheritance and Polymorphism in order to complete this assignment. o Your Sort class must be a pure virtual class.

o You should use proper OO approaches to implementing Inheritance.

• It is recommended you use stringstream to read-in and parse the data file.

• Your sample output must match that shown below - note that in order to "re-sort" the list you must also "re-load" the data file.

• You are required to use an Array to store the data read-in from the file.

• You are required to use the Heap to store your Objects in memory.

• You program should have no memory leaks - a memory leak will result in a deduction of points. o Make sure to run Valgrind against your submission to check for memory leaks and include this report with your submission.

• You are required to provide a brief (about one paragraph per algorithm) overview/analysis of the Big-O runtime of your program with respect to the two sorting algorithms we are implementing as part of this assignment - we will cover this in brief overview in lecture, you will need to provide some additional external research on your own to complete this assignment.

Below is the output of what your program should display when executed:

1. Load Data (From File)

2. Exit Program

Please enter your selection: 1

Unsorted Array: 39, 14, 100, 16, 93, 24, 62, 68, 52, 76, 86, 48, 15, 41, 83, 55, 18, 30, 74, 7, 31, 44, 67, 81, 70, 27, 53, 59, 61, 19, 56, 35, 88, 58, 72, 98, 38, 64, 94, 69, 50, 46, 78, 6, 57, 89, 26, 20, 79, 49

1. Insertion Sort

2. Bubble Sort

3. Exit Program

Please enter your selection: 1

Insertion Sort: 6, 7, 14, 15, 16, 18, 19, 20, 24, 26, 27, 30, 31, 35, 38, 39, 41, 44, 46, 48, 49, 50, 52, 53, 55, 56, 57, 58, 59, 61, 62, 64, 67, 68, 69, 70, 72, 74, 76, 78, 79, 81, 83, 86, 88, 89, 93, 94, 98, 100

1. Load Data (From File)

2. Exit Program

Please enter your selection: 1

Unsorted Array: 39, 14, 100, 16, 93, 24, 62, 68, 52, 76, 86, 48, 15, 41, 83, 55, 18, 30, 74, 7, 31, 44, 67, 81, 70, 27, 53, 59, 61, 19, 56, 35, 88, 58, 72, 98, 38, 64, 94, 69, 50, 46, 78, 6, 57, 89, 26, 20, 79, 49

1. Insertion Sort

2. Bubble Sort

3. Exit Program

Please enter your selection: 2

Bubble Sort: 6, 7, 14, 15, 16, 18, 19, 20, 24, 26, 27, 30, 31, 35, 38, 39, 41, 44, 46, 48, 49, 50, 52, 53, 55, 56, 57, 58, 59, 61, 62, 64, 67, 68, 69, 70, 72, 74, 76, 78, 79, 81, 83, 86, 88, 89, 93, 94, 98, 100

1. Load Data (From File)

2. Exit Program

Please enter your selection: 2

Reference no: EM132217499

Questions Cloud

Create a new xslt style sheet document : The Downtown Zoo has hired you to help work on their web site. They would like to create a page that displays the times that various animals are being fed.
Estimate the value of the mathematical constant e : Write a program that calls MyFact and estimates the value of the mathematical constant e by using the formula.
Accept input and produce output in the same manner : Given a data set of up to 25 integers, determine if there is a constant value which separates every element.
Write a new method that receives the ages array : Write a new method called printArray that receives the ages array and prints the content of the array separated by commas.
Produce a program that sorts a list of numbers in ascending : Your job is to produce a program that sorts a list of numbers in ascending order. Your program will need to read-in, from a file, a list of integers.
Evaluate the use of post-loss risk transfer mechanisms : Advanced risk financing and transfer - To enable candidates to understand the role that risk financing and risk transfer play in risk management
Write out the algorithm on paper of how you propose : If a user enters one of these values, you are to print out the channel number along with its network affiliation.
Prompt the user to enter the data to populate the structure : The program should then prompt the user to enter the data to populate the structure. Finally, use printf( ) to display the information entered by the user.
Allow a process to create another process running : Write both the popen() and pclose() functions and use them in a program. Remember that pclose() allows the original process to be a good parent.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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