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
Fact Pattern: A sales transaction record designed to contain the information presented below. Column Information 1-10 Customer a
ozzi

Answer:

The answer is field check.

Explanation:

The sales transaction record was designed to enter information by range, so the data validation is oriented for range validation and not for a specific logic. In other words, the transaction will check if the information is in a valid range and not if the information is logically valid.

4 0
2 years ago
Weak Induction
slega [8]

Answer:

Following are the answer to this question:

Explanation:

In option 1:

The value of n is= 7, which is (base case)

\to 3^7

when n=k for the true condition:

\to 3^k

when n=k+1 it tests the value:

\to 3^{(k+1)}= 3^k,3\\\to < (k!) 3 \ substituting \ equation \\\to

since k>6  hence the value is KH>3 hence proved.

In option 2:

when:

for n=1:(base case)

\log(1!)

0<=0 \\ condition is true

when the above statement holds value n=1

when n=k

\log(k!)

when n=k+1

\log(k+1)!=\log(k!)+\log(k+1)\\

             

\because k \log k      [\therefore KH>K \Rightarrow  \log(KH>\loK)]

In option 3:

when n=1:

A_1 \cup B=A_1 \cup B\\\\

when n=k

\to (A_1\cap A_2 \cap.....A_k) \cup B\\=(A_1\cup B) \cap(A_2\cup B_2)....(A_k \capB).....(a)\\\to n= k+1\\ \to (A_1\cap A_2 \cap.....A_{kH}) \cup B= (A_1\cup B)\\\\\to  [(A_1\cap A_2 \cap.....A_{k}) \cup B]\cap (A_{KH}\cup B)\\\\\to  [(A_1\cup B) \cap (A_2 \cup B) \cap (A_3\cup B).....(A_k\cup B)\cap (A_{k+1} \cup B)\\\\  \ \ \ \ \ \ substituting \ equation \ a \\\\

hence n=k+1 is true.

7 0
2 years ago
The physical address assigned each network adapter is called its ________.
zysi [14]
MAC address
....................
5 0
3 years ago
So for my Game Design class I have a quiz coming up...I was wondering if someone could answer some of these practice questions,
Over [174]
1. A script or scripting language is a computer language<span> with a series of commands within a file that is capable of being executed without being compiled.
2. Software development
3. true
4. im not sure
here is a sight that might help 
https://quizlet.com/150321269/video-game-design-terms-flash-cards/
</span>
3 0
3 years ago
Read 2 more answers
how can you create fades with the smart tool? How can you specify the types of fade curves that are used with the smart tool?
ra1l [238]

Answer:

The correct answer to the following question is:

To create fades you can click and then drag the end of the clip with a smart tool.

Fade Dialog Box is the fade curve.  

Explanation:

Smart Tool is an application which also provide their users with the features of the quick access menu by which they can easily access their programs or the software.

By using smart tool the user also creates a crossfade.

8 0
3 years ago
Other questions:
  • The set of specific, sequential steps that describe exactly what a computer program must do to complete the work is called a(n)
    10·2 answers
  • ____ is an object-oriented programming language from Sun Microsystems which allows small programs called applets to be embedded
    13·1 answer
  • A network using multiple cell towers falls under which type of network?
    13·1 answer
  • . A program that can run more than one thread at once is called:
    9·1 answer
  • Explain how it is possible for a sequence of packets transmitted through a wide area network to arrive at their destination in a
    14·1 answer
  • By using the search functionality within a twitter stream, users can filter for:
    9·1 answer
  • Write syntactically correct Javascript code to sort an array of sub-arrays containing integers using the sort and reduce array f
    11·1 answer
  • A network technician is designing a network for a small company. The network technician needs to implement an email server and w
    7·1 answer
  • Write a calculate_sq_inches_of_good_pizza function that accepts the diameter of a pizza and returns the area of the pizza minus
    7·1 answer
  • Which background-repeat value represents this div?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!