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
miss Akunina [59]
3 years ago
12

assume that you want to sort an array have 100000 elements which algorithm (insert sort algorithm or quick sort algorithm) is th

e best option ? why?
Computers and Technology
1 answer:
Rama09 [41]3 years ago
4 0

Answer:

Quick Sort.

Explanation:

Quick Sort will be best suited for an array having 100000 elements instead of the insertion sort algorithm because as we know the average time complexity of quick sort is O(NlogN) and for insertion sort is O(n^2).The sorting totally depends upon the pivot that is being selected in quick sort.

While insertion sort is best suited for arrays that are already sorted it takes O(n) time in those cases.

Since the array that we have is very large and so we need an algorithm that can sort the array faster than the other sorting algorithms.Quick  Sort is also inplace and does not requires extra space to do the sorting.

You might be interested in
Which of the following class definition defines a legal abstract class Group of answer choices public class Rectangle abstract {
valkas [14]
<h2>Question</h2>

Which of the following class definition defines a legal abstract class Group of answer choices

(a)

public class Rectangle abstract {

   public abstract double findArea ( );

   

}

(b)

public abstract class Rectangle {

   public abstract double findArea ( );

   

}

(c)

public class Rectangle {

   public abstract double findArea ( );

   

}

(d)

public class abstract Rectangle {

   public abstract double findArea ( );

   

}

<h2>Answer:</h2>

(b)

public abstract class Rectangle {

   public abstract double findArea ( );

}

<h2>Explanation:</h2>

When a class is declared with the abstract keyword, the class is called an abstract class. Abstract classes cannot be instantiated and may include one or more abstract methods. If a class contains an abstract method, then it (the class) must be declared abstract.

In Java, abstract classes are defined using the following format:

<em>[access_modifier]</em> abstract class <em>[name_of_class]</em>

[access_modifier] specifies the access modifier of the class which could be public, private, e.t.c

abstract is the keyword that specifies that the class is an abstract class.

class is a keyword used for defining classes

name_of_class specifies the name of the class.

The only option that fulfils this format is <em>option b</em> where;

(i) The access modifier is public

(ii) The name of the class is Rectangle

Option a is not correct because the <em>abstract</em> keyword is supposed to come before the <em>class</em> keyword.

Option c is not correct because the keyword <em>abstract</em> is missing. In other words, the class must be declared abstract since it contains abstract method findArea();

Option d is not correct because the <em>abstract</em> keyword is supposed to come before the <em>class</em> keyword.

7 0
2 years ago
If you create and invoke a recursive function without accounting for a base case, what can go wrong?
oksian1 [2.3K]

Every recursive function should have an exit criterion (=handling the base case) to exit the recursion.

Without it, it wil recurse forever, until system resources run out (typically the call stack will overflow and your program will crash).

6 0
3 years ago
Design a program that asks the User to enter a series of 5 numbers. The program should store the numbers in a list then display
klasskru [66]

Answer:

The program in Python is as follows:

numbers = []

total = 0

for i in range(5):

   num = float(input(": "))

   numbers.append(num)

   total+=num

   

print("Lowest: ",min(numbers))

print("Highest: ",max(numbers))

print("Total: ",total)

print("Average: ",total/5)

Explanation:

The program uses list to answer the question

This initializes an empty list

numbers = []

This initializes total to 0

total = 0

The following loop is repeated 5 times

for i in range(5):

This gets each input

   num = float(input(": "))

This appends each input to the list

   numbers.append(num)

This adds up each input

   total+=num

   

This prints the lowest using min() function

print("Lowest: ",min(numbers))

This prints the highest using max() function

print("Highest: ",max(numbers))

This prints the total

print("Total: ",total)

This calculates and prints the average

print("Average: ",total/5)

6 0
3 years ago
Convert the following numbers from decimal to binary, assuming unsigned binary representation:________.
kumpel [21]

Answer:

Binary representations of following are:

A) 35 = 100011

B) 3 = 11

C) 27 = 11011

D) 16 = 10000

Explanation:

The method to generate the binary number from a decimal is :

Keep on dividing the number by 2 and keep on tracking the remainder

And the quotient is again divided and remainder is tracked so that the number is completely divided.

And then write the binary digits from bottom to top.

Please have a look at the method in below examples:

A) 35

\begin{center}\begin{tabular}{ c c c }Number & Quotient & Remainder\\ 2 & 35 & 1 \\  2 & 17 & 1 \\   2 & 8 & 0  \\ 2 & 4 & 0  \\ 2 & 2 & 0   \\ 2 & 1 & 1\end{tabular}\end{center}

Writing the remainder from bottom to top.

So, binary number is 100011

B) 3

\begin{center}\begin{tabular}{ c c c }Number & Quotient & Remainder\\ 2 & 3 & 1 \\  2 & 1 & 1 \\  \end{tabular}\end{center}

Writing the remainder from bottom to top.

So, binary equivalent is 11.

C) 27

\begin{center}\begin{tabular}{ c c c }Number & Quotient & Remainder\\ 2 & 27 & 1 \\  2 & 13 & 1 \\   2 & 6 & 0  \\ 2 & 3 & 1  \\ 2 & 1 & 1   \end{tabular}\end{center}

Writing the remainder from bottom to top.

So, binary equivalent is 11011.

D) 16

\begin{center}\begin{tabular}{ c c c }Number & Quotient & Remainder\\ 2 & 16 & 0 \\  2 & 8 & 0 \\   2 & 4 & 0  \\ 2 & 2 & 0  \\ 2 & 1 & 1   \\\end{tabular}\end{center}

Writing the remainder from bottom to top.

So, binary equivalent is 10000.

Answers are:

Binary representations of following are:

A) 35 = <em>100011</em>

B) 3 = <em>11</em>

C) 27 = <em>11011</em>

D) 16 = <em>10000</em>

8 0
3 years ago
HELP ME PLZZ FFFAAASSSTTTT
Dahasolnce [82]
The answer has to be A because we you get your licensed suspended you are un able to drive for a while Intel you take the test again and or pay a fine
6 0
3 years ago
Read 2 more answers
Other questions:
  • When people need information, they typically turn to:
    7·1 answer
  • python If the checksum is 10, the last digit is denoted as X according to the ISBN-10 convention. Write a program that prompts t
    10·1 answer
  • Write an algorithm to determine a students final grade and indicate whether it is passing or failing .the final grade is calcula
    12·1 answer
  • Haley is helping to choose members for a customer satisfaction team. Which
    6·1 answer
  • The primary function of application software is to apply the power of the computer to enable people, workgroups, and the entire
    7·1 answer
  • Universal Containers requires that all users add at least one Product Option from the Maintenance Feature to a bundle.
    5·1 answer
  • Which relation is created with the primary key associated with the relationship or associative entity, plus any non-key attribut
    6·1 answer
  • What is computer assisted translation​
    9·1 answer
  • Instruction: Decide what the total marketing budget will be, and make a list of at least four things you will spend money on and
    15·1 answer
  • Visit on social networking site and look for the site's privacy policy.The link is typically found at the bottom of the page and
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!