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
olchik [2.2K]
3 years ago
14

In this problem you will test and analyze the following sorting algorithms: Selection, Bubble, Insertion, Merge, and Quick. You

can use the code provided in the lecture slides after modifying it to meet the following requirements: 1. Analyze the algorithms by sorting, in ascending order, arrays of 1000 integers (i.e., no need to use template functions as in the lecture slides). 2. Create three arrays of 1000 integers: BST, AVG, and WST. Where a. BST has 1000 integers already sorted in ascending order (e.g., 10, 20, 30, ...etc.). b. AVG has 1000 randomly generated integers, where each integer is between 0 and 100,000. c. WST has 1000 integers sorted in reverse order (e.g., 1000, 990, 980, ...etc.). 3. Test the five sorting algorithms with three 1000‐integer arrays: tBST, tAVG, and tWST. Before testing each algorithm, these three arrays (tBST, tAVG, and tWST) must be re‐initialize as copies from BST, AVG, and WST respectively (you can write a function to carry out the copy task). This is to make sure that all algorithms are tested with an identical set of arrays.
Computers and Technology
1 answer:
Tpy6a [65]3 years ago
5 0

Answer:

1) Selection, bubble and insertion sort requires no moves in the sorted array because there will be n comparisons in the array and no swapping would take place after each comparison so zero moves.

2) Bubble and insertion sort result in 999 comparisons as we are required to iterate only one time over the array. this can be easily explained from the diagram as in bubble sort all the elements will be in their sorted position so each element will be encountered only once.

3) In selection sort, any element is compared with all the elements and accordingly smaller is paced first so in the reverse sorted array there will be at least n^2 comparisons so n^2 moves.

4) in merge sort an array is always divided into n nos of parts and then sorted so in worst case as well as best case the array will be divided so same numbers of moves.

You might be interested in
I need help also this counts as my second giveaway and last for today
kifflom [539]

Answer:

I am pretty sure its the Visual card

8 0
3 years ago
Read 2 more answers
Select the three business advantages of globalization.
Anna007 [38]

Answer:

There is increased collaboration in problem solving.

There are increased business opportunities.

It facilitates ease in communication

4 0
3 years ago
if we declare a function as friend of a template class will it be a friend for a particular data type or for all data types of t
suter [353]

Answer:

When we declare a function as a friend of a template class, it means it can access the public, as well as the private and protected members both data variables, and functions of that class. Thus, the friend has access not only to certain data types, but they have access to all the data types of that class. Thus, the function declared as the friend is never deprived of accessing any particular data type of a template class, or any class.

Explanation:

However, you should understand what is template class as well. A template class is the one that is a template and can be transformed into various object code for various data types, that supports all the operators used inside that class or function. We do have the template function. And these behave generically.

7 0
3 years ago
Fill in each blank with the correct answer/output.
borishaifa [10]

Answer:

37

Explanation:

Given int[] vals = {7,5,3,9,0,37,93,16,68,6,99};

In programming, the position of each value in the list are known as index. The first value is always assigned index of 0 not 1, the second value is assigned index of 1 and so on. For example;

val[0] = 7 i.e value with index 0

val[1] = 5

val[4] = 0

In order to print out this value

System.out.println(vals[vals[1]+vals[4]]);

Substituting the index value val[1] and val[4] into the argument given

vals[vals[1]+vals[4]]

= vals[5+0]

= vals[5]

= 37 (value at the 5th index)

System.out.println(vals[vals[1]+vals[4]]);

= 37

This means that the system will print out 37 to the console

4 0
4 years ago
Which of the following is NOT true about the ways that various professions use computers? Police use them to track criminals. Pi
ira [324]
Pilots use them to learn at first, but rarely afterwards<span> is NOT true about the ways that various professions use computers</span>
8 0
3 years ago
Other questions:
  • A ________ is when teachers develop a professional based network of people selected by him/her to pursue learning needs and shar
    12·1 answer
  • Jeff is preparing for a presentation on effective communication skills. He has to face an audience of over 50 people. Which stra
    9·2 answers
  • Invention I chose was radio.
    9·1 answer
  • True or false. Embedding only part of a font is called presetting.
    14·1 answer
  • 38. To select nonadjacent items, select the first item, such as a word or paragraph, as usual; then, press and hold down the ___
    8·1 answer
  • 1⁰=?<br> Is equal to...........
    12·2 answers
  • The sales of last 6 months are stored in a list,
    12·1 answer
  • It is not important to type '=' before a formula or a function
    12·1 answer
  • Emanuel studies hard for hours on end until bedtime, yet his grades could be better. What can he do to improve his academic perf
    6·1 answer
  • What’s the highest stock today?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!