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
An advertisement for new headphones lists the cool colors available, the great sound quality, and the fabulous reviews but fails
Mama L [17]

d transfer

ive seen the ad

7 0
3 years ago
LIST THE SKILLSET NEEDED FOR BECOMING A PROGRAMMER.
wolverine [178]

Answer:

Proficiency with programming languages.  

Learning concepts and applying them to other problems.  

Mathematical skills.  

Problem-solving capability.  

Communication skills.

Writing skills.  

Inquisitiveness.  

Self-motivation.

7 0
2 years ago
HIPAA protects which of the following kinds of data?
Gelneren [198K]
The answer is a i looked up the question and it says a
5 0
3 years ago
Read 2 more answers
Energía de movimiento de los átomos o moléculas
olasank [31]

Answer:

g

Explanation:

4 0
2 years ago
Some problems are better solved by a computer and some are better solved by humans.
aalyn [17]

Answer:

I say when u don't know the answer completly.

3 0
3 years ago
Other questions:
  • Write a program that assigns two integer values from standard input to the variables int1 and int2, then prints "true" if they a
    10·1 answer
  • The destructor automatically executes when the class object goes out of ____.
    12·1 answer
  • To expand the interface within CengageNOWv2, you need to click on the:_______.
    15·1 answer
  • Identify the benefit of modeling to communicate a solution. ​
    11·2 answers
  • 2. You have noticed over the past several days that your computer is running more slowly
    6·2 answers
  • What is one reason the number of DUIs has dropped?
    7·1 answer
  • What type of machine is a hand drill?<br><br> A. Simple machine <br> B. Compound machine
    8·2 answers
  • Someone plz answer
    8·1 answer
  • The structure of the atmosphere based temperature changes ​
    5·1 answer
  • I used a walmart MoneyCard and now it says its prepaid. Its my dad's card.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!