Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This requires the use of C++. The files above make up a utility for generating inputs for algorithms. This particular one generates list of N

This requires the use of C++.

The files above make up a utility for generating inputs for algorithms. This particular one generates list of N random numbers that are sorted.

The main function declares an array of a number of elements and calls the efficientRandomSortedList function to populate the array with random integers, with the condition that the numbers are sorted. It uses the TimeSupport.h library to keep track of the running time of the generating function.

The generating function itself is defined in DataGen.h. The current version uses the RandomSupport.h library to generate as many random integers as needed, and then uses insertion_sort to sort the list and produce the desired output.

The Compass system has a time limit of 5 seconds for your programs to run. If your program has not completed within that time, it will be terminated.

If the size of the array is small enough, the algorithm in DataGen.h will manage to complete in under 5 seconds, but for larger lists, we need more efficient algorithms.

Given the files below, modify the efficientRandomSortedList function, in DataGen.h to be able to generate 15000000 random numbers (with no repeats) in sorted order, within the 5 second time limit. Test your function by modifying the list size in the dataGen.cpp file to 15000000.

I want to replace the insertion_sort algorithm with QuickSort in order to quickly handle 15000000 random numbers. How do I do that with the given code below?

image text in transcribed

image text in transcribed

dalaGeni - Microsoft Visusl 5tudio Express 2012 for Winduws Deskiop Quick Launch (Cti+o IL[ CDIT ViLW PROJECT BUILD DLDLIG TLAM TCOLS TLST WINDOW HELP o , o TB e-" .. Local windows Debugger , Debug win32 TimeSuapor.h andomSupport. DataGon.h Solution Explerer Global Scope) O displaylong listu long s A simple function for displaying the contents of an array Sesch 5olution Explorer (Cl void display(long list[], long s) for (long i =0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions

Question

Knowledge of project management (PMI) teachings

Answered: 1 week ago