Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can anyone please help me with this ? Thank you!! 2. Counting Inversions (a) Create a NetBeans Project named InversionCount. It will not have a

image text in transcribed
Can anyone please help me with this ?
Thank you!!
2. Counting Inversions (a) Create a NetBeans Project named InversionCount. It will not have a constructor, but its main method will print out information on the average number of inversions in a random permutation of n comparable items. In particular, you may use StdRandom and StdOut. You should get the controlling parameters from as command line arguments (b) For a given n (the length of the array) you should perform the following task M times: create an array of size n, initialized to [0, 1,2,... ,n -1], shuffle this array to randomize its order count the number of inversions in this shuffled array keeping track of the running total of inversions so that you can report the average number. (Extra points for using an Accumulator object (c) Your inversion counting method should be recursive (d) Specify the initial list size, the limiting list size, and the number or trials in each averaging computation (think about 10-20) (e) A in the problem from last term where we compared sorting times, compute doubling time ratios and print out the results. A sample output would look like N Avg. Invs 21.70 90.10 404.40 96.80 160 6128.20 320 25998.30 640 101976.00 1280 412275.90 2560 1632479.10 Ratio 10 20 40 80 4.1521 4.4883 3.9486 3.8378 4.2424 3.9224 4.0429 3.9597 15

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_2

Step: 3

blur-text-image_3

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions