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
kifflom [539]
3 years ago
12

2.Consider the following algorithm and A is a 2-D array of size ???? × ????: int any_equal(int n, int A[][]) { int i, j, k, m; f

or(i = 0; i < n; i++) for( j = 0; j < n; j++) for(k = 0; k < n; k++) for(m = 0; m < n; m++) if(A[i][j]==A[k][m] && !(i==k && j==m)) return 1 ; return 0 ; } a. What is the best-case time complexity of the algorithm (assuming n > 1)? b. What is the worst-case time complexity of the algorithm?
Computers and Technology
1 answer:
Elis [28]3 years ago
5 0

Answer:

(a) What is the best case time complexity of the algorithm (assuming n > 1)?

Answer: O(1)

(b) What is the worst case time complexity of the algorithm?

Answer: O(n^4)

Explanation:

(a) In the best case, the if condition will be true, the program will only run once and return so complexity of the algorithm is O(1) .

(b) In the worst case, the program will run n^4 times so complexity of the algorithm is O(n^4).

You might be interested in
3. What are two reasons for versioning your still life project file? (1.0 points)
inna [77]

Answer:

The project file can be managed by making its multiple version due to the following reasons.

1. We can create multiple copies or version of the project to avoid any unfortunate circumstance such as Project file can be corrupted or can be deleted. In that case we can use the other version of that project file.

2. When we are working on some project, we are modifying the code or program to achieve our desired results. In this process we may forgot the changes that we have made while modification. If we does not obtain our desired results while modification that can lead to losing the original file. To reduce this type of risk we create multiple versions of project File.

3. We also create version of our project files on some internet drives as a backup. In case our computer has lost or operating system has been corrupted. A version of our project file is available on Internet drives such as Google drive or Drop box.

3 0
3 years ago
I got a 52 on my test :(
Eduardwww [97]

Answer:

that sucks i hope u can do better next time have a good day

Explanation:

7 0
3 years ago
HELP ASAP DONT ANSWER WITH A LINK​
OlgaM077 [116]

Answer:

<u>Layout</u>

title

title and content

section header

comparison

<u>Orientatio</u><u>n</u>

landscape

portrait

8 0
3 years ago
Describe Atari and explain how the level of technology available at the time impacted the development of Atari game systems
Gelneren [198K]

Answer:

Atari is something that is dangerous .

has led to many bad things to the young ones

4 0
2 years ago
Write a function that takes two arguments and returns their sum.
zavuch27 [327]

Answer & Explanation #1

To answer your first query. You can write a function that takes two arguments and returns their sum like this:

#Python program to add two numbers using a function

def add_num(a,b): #function for addition

   sum=a+b

   return sum #return value

num1=25  #variable declaration

num2=55

print("The sum is",add_num(num1,num2)) #call the function

Answer & Explanation #2

As for your error, I believe it is an indent error in your first return statement. All you must do is indent the return statement.

5 0
3 years ago
Other questions:
  • You are running an application in Google App Engine that is serving production traffic. You want to deploy a risky but necessary
    9·1 answer
  • Select all that apply.
    8·2 answers
  • Multiple users report that the network printer, which is connected through the print server, is not printing. Which of the follo
    12·1 answer
  • Electromagnetic waves used in ovens and cell phone communications are called
    6·1 answer
  • Name at least two types of career options that are available for someone with strong typing skills?
    10·2 answers
  • What are the advantages of saving files in a cloud? <br>Please help!! ​
    11·2 answers
  • WILL GIVE BRAINLIEST!!!!!!!
    10·2 answers
  • To locate all the documents in a Mongo database that match an expression, use the _____________ method.
    12·1 answer
  • Write a program that outputs "Hello World!".
    8·1 answer
  • Question 2 of 10
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!