1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ad-work [718]
3 years ago
14

Perform algorithm time measurement for all three quadratic sorting algorithms for Best Case (already sorted), Average Case (rand

omly generated), and Worst Case (inverse sorted) inputs and compare them with O(N*logN) sorting algorithm using Arrays.sort() method. Use arrays sizes of 50K, 100K, and 200K to produce timing results.
Computers and Technology
1 answer:
Kaylis [27]3 years ago
5 0

Answer:

Experiment size : 50,000

==================================

Selection sort :

---------------------------------------------------------

Worst case : 0.162

Average case : 0.116

Best case : 0.080

Insertion sort :

---------------------------------------------------------

Worst case : 0.162

Average case : 0.116

Best case : 0.080

Bubble sort:

--------------------------------------------------------

Worst case : 0.211

Average case : 0.154

Best case : 0.117

Experiment size : 100,000

==================================

Selection sort :

---------------------------------------------------------

Worst case : 0.316

Average case : 0.317

Best case : 0.316

Insertion sort :

---------------------------------------------------------

Worst case : 0.316

Average case : 0.317

Best case : 0.316

Bubble sort:

--------------------------------------------------------

Worst case : 0.482

Average case: 0.487

Best case : 0.480.

Experiment size : 200,000

==================================

Selection sort :

---------------------------------------------------------

Worst case : 1.254

Average case : 1.246

Best case : 1.259

Insertion sort :

---------------------------------------------------------

Worst case : 1.254

Average case : 1.246

Best case : 1.259

Bubble sort:

--------------------------------------------------------

Worst case : 1.990

Average case : 2.009.

Best case : 1.950

Explanation:

[NB: since it is very long there is the need for me to put it it a document form. Kindly check the doc. Files. The file A is the sort Analysis.Java file and the file B is the sort.Java file].

The concept of algorithm time measurement strictly depends on the following;

=> The measurement of time, space or energy on different sizes.

=> Plotting of the measurements and characterizing them.

=> Running or implementation of the algorithm.

Programming language such as Java can be used in accessing the operating system clock and Java had two static methods.

KINDLY CHECK BELOW FOR THE ATTACHMENT.

Download doc
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> doc </span>
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> doc </span>
You might be interested in
Which of the following is considered to be open-end credit?
tia_tia [17]

Department store charge cards are considered open-end credit, so the answer is C.

4 0
3 years ago
Read 2 more answers
Write a zip code class that encodes and decodes 5-digit bar codes used by the U.S. Postal Service on envelopes. The class should
8_murik_8 [283]

Answer:

#include<iostream>

#include<string>

using namespace std;

class zip_code

{

private:

int zipcode;

string get_string(int num)

{

string str="";

if(num == 0) return "11000";

if(num>7)

{

str.append("1");

num = num-7;

}

else

str.append("0");

if(num>4)

{

str.append("1");

num = num-4;

}

else

str.append("0");

if(num>2)

{

str.append("1");

num = num-2;

}

else

str.append("0");

if(num>1)

{

str.append("1");

num = num-1;

}

else

str.append("0");

str.append("0");

return str;

}

public:

zip_code(int barcode)

{

if(barcode<10000 || barcode>99999)

cout <<"Invalid Bar code passed to constructor." << endl;

else

zipcode = barcode;

}

zip_code(string barcode)

{

if(barcode.length()>27)

cout <<"Invalid Bar code passed to constructor." << endl;

else

{

int zipper = 0;

string str_local = barcode.substr(1,barcode.length()-2);

for(int i=0; i<str_local.length()-5; i+=5)

{

int local = 0;

local = 7*(str_local[i]-'0') +

       4*(str_local[i+1]-'0') +

       2*(str_local[i+2]-'0') +

       1*(str_local[i+3]-'0');

if(local == 11) local = 0;

       zipper = zipper*10 + local;

}

zipcode = zipper;

}

}

string getZipcode()

{

string str = "1";

int first = zipcode/10000;

int second = (zipcode - first*10000)/1000;

int third = (zipcode - first*10000-second*1000)/100;

int fourth = (zipcode - first*10000-second*1000-third*100)/10;

int fifith = (zipcode - first*10000-second*1000-third*100-fourth*10);

str.append(get_string(first));

str.append(get_string(second));

str.append(get_string(third));

str.append(get_string(fourth));

str.append(get_string(fifith));

str.append("1");

return str;

}

int get_zipCode()

{

return zipcode;

}

};

int main()

{

zip_code z1(123456);

zip_code z2(99504);

cout << z2.getZipcode() << endl;

system("pause");

return 0;

}

4 0
4 years ago
Jonas is an experienced security professional who recently accepted a position in an organization that uses Check Point firewall
vichka [17]

Answer:

CCSA

Explanation:

CCSA is "Checkpoint Certified Security Administrator". This certification is best suited for Jonas.

8 0
3 years ago
Select all that apply.
MrRissso [65]
Hello there,
The answer is ‘CTRL’
Thanks!
7 0
3 years ago
Which generation of programming languages provides programmers with a visual environment for coding programs?
Andreyy89

5GL or the fifth-generation language is programming that uses a visual or graphical development interface to create source language that is usually compiled with a 3GL or 4GL language compiler.  Fifth Generation Programming or Visual programming language, is also known as natural language. It provides a visual or graphical interface, called a visual programming environment, for creating source codes.

6 0
3 years ago
Other questions:
  • Jeremy, a college student, is preparing to give a speech on "Social Responsibilities." He refers to a Web page on a tab using
    10·1 answer
  • What quadrants in the johari window need to shrink in order for us to gain greater self-awareness?
    5·1 answer
  • In Java please.
    13·1 answer
  • Larry finds it easy to run legacy programs and applications in a virtualized environment. how does the virtualization provider m
    7·2 answers
  • Plz answer me will mark as brainliest​
    13·1 answer
  • WHO SAYS BUP ALL THE TIME ​
    8·1 answer
  • Write a program that prints the numbers 1 - 50. If the number is even print the word 'EVEN!' next to it. If the number is odd pr
    10·1 answer
  • The following method is intended to remove all values from the ArrayList a that have the same value as val; however, this method
    8·1 answer
  • how is a two-dimensional array different from a traditional one dimensional array? From an ArrayList?
    6·1 answer
  • Which of the following was the first computer-animated film to win animated film to win an academy award?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!