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
andrew11 [14]
3 years ago
14

1. Given a sequential list with n numbers, represented in a one-dimensional array A) Write an algorithm to check if the list has

any duplication. Explain the time complexity of your algorithm. Can you think of a better algorithm to do the job? If so, briefly explain. B) Write an algorithm to find all the duplicate numbers in the list, if any. Explain the time complexity of your algorithm. Can you think of a better algorithm to do the job? If so, briefly explain.
Computers and Technology
1 answer:
lutik1710 [3]3 years ago
8 0

Answer:

Define a function that accept a list as an argument. Save the length of the list as a variable and cast the list to a set and also save the length to a variable.

If the result of the subtraction of the set length from the list length is not equal to zero, then the list have duplicates.

Explanation:

A sample of the source code using Python,

def list_duplicate( list ):

list_len = len( list )

new_set = set( list )

set_len = len( new_set )

If list_len - set_len != 0 :

Print( " The list has duplicate " )

You might be interested in
Hisoka is creating a summary document for new employees about their options for different mobile devices. One part of his report
algol13

Hisoka would not include in his document that is Apple users file-based encryption to offer a higher level of security.

<h3>Does Apple use the file based encryption?</h3>

It is said that iOS and iPad OS devices are known to often use a file encryption system known to be Data Protection.

Therefore,  Hisoka would not include in his document that is Apple users file-based encryption to offer a higher level of security.

Hence option A is correct.

Learn more about encryption from

brainly.com/question/9979590

#SPJ1

3 0
2 years ago
What is a gamer?
mixer [17]

Answer:

It is <em>definitely </em>D.

Explanation:

I am a gamer myself so this question is easy for me. It's slim to none to be wrong when you view my answer!!!

7 0
2 years ago
Which focal length and aperture combination is most likely to give you a deep depth of field?
frutty [35]

Answer:

f/11 is the answer I think

3 0
2 years ago
Jennifer has written a business report. What should be her last step before she submits the story for publication?
Montano1993 [528]
Revising and editing because it makes the report look sharp and business like.
5 0
3 years ago
Read 2 more answers
Write a statement that defines an ifstream object named inputFile and opens a file named "Friends.txt".
Simora [160]

Answer:

ifstream inputFile;

inputFile.open("Friends.txt");

Explanation:

Though, the programming language is not stated, questions like this are often from C++.

The first statement defines the ifstream object using the following syntax.

ifstream [object_name]

In this case, the object name is inputFile

So, the syntax becomes

ifstream inputFile;

The next line opens a file using the following syntax.

[object_name].open("Filename")

Here, object_name is inputFile and filename is Friends.txt

So, the open statement becomes

inputFile.open("Friends.txt")

5 0
3 years ago
Other questions:
  • The following algorithm computes the average height for a list of basketball player heights. Initialize a variable sum to 0. For
    11·2 answers
  • Create a SavingsAccount class. Use a static data member annualInterestRate to store the annual interest rate for each of the sav
    10·1 answer
  • You are running out of storage space on one of your servers. you need to purchase an external hard drive, as there are no drive
    8·2 answers
  • Help me right now!!!!!!!!!!!!!!!!!!!!!!!!11
    15·1 answer
  • Which of the following is NOT one of the three basic structures used to solved logical problems?
    7·1 answer
  • What is it called when there are an equal number of characters on either side of the horizontal center of the page?
    8·1 answer
  • Credible sites contain __________ information,
    7·2 answers
  • A10:A20 Refer to values in
    8·1 answer
  • Mario is giving an informative presentation about methods for analyzing big datasets. He starts with the very basics, like what
    13·1 answer
  • What is the output of the following code?<br> print (12 // 6)
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!