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
sergeinik [125]
3 years ago
13

Al and Bill are arguing about the performance of their sorting algorithms. Al claims that his O(N log N)-time algorithm is alway

s faster than Bill's O(N2)-time algo- rithm. To settle the issue, they implement and run the two algorithms on many randomly generated data sets. To Al's dismay, they find that if N 〈 1000 the O(N2)- time algorithm actually runs faster, and only when N 〉 1000 the 0(N logN)-time (10 pts.) one is better. Explain why the above scenario is possible
Computers and Technology
1 answer:
lisabon 2012 [21]3 years ago
7 0

Answer:

See in Explanation

Explanation:

All you know is that an O(n log n) algorithm is eventually (a lot) faster than an O(n^{2} ) algorithm, but for any specific value of n, you can't say anything. Indeed, the asymptotic growth of the function doesn't depend on its value on n. This means that if  f(n)=O(n^{2} ) then for all c_{1} ,....\ , c_{99}, the following function is also O(n^{2} ):

f^{'} (n)=[\ cnf(n)\  if \ n

So asymptotic notation is completely uninformative regarding the performance of algorithms on specific values of n.

You could say that functions such as f^{'}(n) are artificial and never really occur in practice. This is not quite true (you can hard-code some auxiliary information for small n, for example), but even if you consider "natural" functions, asymptotic notation doesn't help you to determine anything other than asymptotic's: consider for example n^{2} against 10^{100}n\  log \ n (such examples definitely happen in practice, for example in fast matrix multiplication).

You might be interested in
Implement a Python function with the signature Transfer(S, T) that transfers all elements from the ArrayStack instance S onto th
Mashutka [201]

Answer:

Following are the program in the Python Programming Language.

#define function

def Transfer(S, T):

 #set for loop  

 for i in range(len(S)):

   #append in the list

   T.append(S.pop())

 #return the value of the list

 return T

#set list type variable

S = ["a","b","c","d"]

#print the values of the list

print(S)

#set the list empty type variable

T=[]

#call the function

T = Transfer(S, T)

#print the value of T

print(T)

<u>Output:</u>

['a', 'b', 'c', 'd']

['d', 'c', 'b', 'a']

Explanation:

Here, we define the function "Transfer()" in which we pass two list type arguments "S" and "T".

  • Set the for loop to append the values in the list.
  • Then, we append the value of the variable "S" in the variable "T".
  • Return the value of the list variable "T" and close the function.
  • Then, set the list data type variable "S" and initialize the elements in it and print that variable.
  • Finally, we set the empty list type variable "T" and store the return value of the function "Transfer()" in the variable "T" then, print the value of the variable "T".
4 0
3 years ago
25 points
Mnenie [13.5K]

A code of ethics and professional conduct outlines the ethical principles that govern decisions and behavior at a company or organization. They give general outlines of how employees should behave, as well as specific guidance for handling issues like harassment, safety, and conflicts of interest.

5 0
3 years ago
Read 2 more answers
(Java) Write a program that accepts a number of minutes and converts it both to hours and days. For example, 6000 minutes is 100
iogann1982 [59]
Import java.util.Scanner;
public class MinutesConversion {
private static Scanner inputDevice;
public static void main(String[] args) {
int minutes, hours;
float days; // float for decimal point

inputDevice = new Scanner(System.in);
System.out.println("Please enter minutes for conversion >> ");
minutes = inputDevice.nextInt();
hours = minutes / 60;
days = hours / 24.0f;


System.out.println(+ minutes + " minutes is " + hours + " hour(s) or" + days " days");
}
}
6 0
3 years ago
Easy coding question, please help.
borishaifa [10]

Answers:

What is the index of the last element in the array? stArr1.length()-1

This prints the names in order. How would I print every other value? Change line 4 to: index = index +2

Change line 7 to: i < names.length

5 0
3 years ago
Determine if the situation below is a safe practice: Julia needs to hang some industrial shelvinv, so she carefully selects the
hichkok12 [17]
I think Julia did good.











Its safe 
7 0
4 years ago
Read 2 more answers
Other questions:
  • An unwanted 'explosion' of inbox messages is called​
    8·2 answers
  • As the performance of PCs steadily improves, computers that in the past were classified as midrange computers are now marketed a
    9·1 answer
  • Using information from the lesson, explain how new technologies change your experience as a consumer.
    5·2 answers
  • Enter the number 2568 into the box below
    14·1 answer
  • HELP ASAP U GET BRAINLIEST
    15·2 answers
  • for what reason do some security professionals consider insiders more dangerous than outside intruders?
    8·1 answer
  • When adding cells you must use a "+" symbol, you cannot use a ":" symbol.<br><br> ☐ True<br> ☐ False
    13·1 answer
  • Voice authentication requires speech to text capability Facial recognition may be used for authentication The human iris is uniq
    6·1 answer
  • D) Informal high level descuption of an algorithm in english kcalled
    9·2 answers
  • What is the role of science and technology in achieving human’s ultimate goal or the good life?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!