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
What are benefits of using debugging tools? Check all that apply.
vivado [14]

Answer:

It's

A. Debugging tools help programmers catch errors they might otherwise miss.

B. Debugging tools can save time.

D. Debugging tools help programmers make methodical assessments of the problem.

Explanation:

got it right on edge.

6 0
3 years ago
Python 3.8.2 detais
olga2289 [7]

Answer:

me dont know

Explanation:

5 0
3 years ago
A portable electronic device that can be used in an emergency to stop someone’s heart from going out of rhythm is called a/an
JulsSmile [24]
It is called a Heart pace maker
7 0
3 years ago
Read 2 more answers
What are these receivers called?
AlexFokin [52]

Answer: Cell site / Base station

Explanation:

A mobile network also referred to as the cellular network is refered to as the radio network which is distributed over the land areas which are refered to as the cells.

We should note that each is served by at least one fixed-location transceiver, which is called the cell site or the base station.

4 0
2 years ago
What obstacles could prevent you from getting and keeping a job
stepladder [879]
Drugs, No Collage, Gangs, bad grades, Criminal Records →
7 0
3 years ago
Other questions:
  • Instructions:Type the correct answer in the box. Spell all words correctly.
    14·2 answers
  • i see tabs named mowed and Ramsey i tried shredding them and deleting them and ending all the processes but they start duplicati
    13·1 answer
  • What happens of the gamers dont follow the age ratings
    14·2 answers
  • The frequencies licensed by telecommunication firms to provide wireless service is known as _____.
    13·1 answer
  • What is the difference between a try block and a try statement? Group of answer choices There is no difference; the terms can be
    6·1 answer
  • In the following code: function drawCircle(radius, x, y, color) { var circle = new Circle(radius); circle.setPosition(x, y); cir
    7·1 answer
  • ____ a device receiving a process variable
    12·1 answer
  • A Lost link is an interruption or loss of the control link between the control station and the unmanned aircraft, preventing con
    10·1 answer
  • How to tell if your phone is being monitored
    12·1 answer
  • Can someone send me reference on communication, importance , communication cycle , pros and cos​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!