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
What are the three main components of a for loop?
insens350 [35]

Answer:

Similar to a While loop, a For loop consists of three parts: the keyword For that starts the loop, the condition being tested, and the EndFor keyword that terminates the loop.

Explanation:

Loop statements usually have four components: initialization (usually of a loop control variable), continuation test on whether to do another iteration, an update step, and a loop body.

8 0
3 years ago
What are the two categories of problems that we can simply convert<br> to parallel code?
anastassius [24]
Percentage and decimals
7 0
3 years ago
Keystroke loggers are stealth software packages that are used to monitor keyboard activities. Which is the best location to plac
irina [24]

Answer: Keyboard hardware & the operating system

Explanation:Keystroke loggers is also referred as the monitoring system which is a for the inspection of the every key pressed on an operating system. This technology monitors the activities of keypad devices such as smart phones etc. It is also used for the surveillance of the unauthorized activities that are done by the hackers or criminals.

Thus the correct option is keyboard hardware and the operating system is the location of the placement of the key loggers.

7 0
3 years ago
Describe how implementation of a raid level 2 system would be beneficial to a university payroll system
lisabon 2012 [21]

<span>The RAID level 2 could give high information exchange rates and would be straightforward contrasted with other Raid levels. Be that as it may, it has a high cost and would need a high rate move required with a specific end goal to legitimize this cost.</span>

4 0
4 years ago
What are some ways you can use the Effect Options dialog box to customize animations in a presentation? Check all
aliina [53]
The first and the 3 ones
4 0
3 years ago
Read 2 more answers
Other questions:
  • What is the differnces between dark and middle ages of computer?​
    9·1 answer
  • What is “centrifugal bumble puppy”? why is it important for games to require a complicated apparatus?
    10·2 answers
  • What action makes RAM on your computer disappear?
    12·2 answers
  • A site structure that contains multiple links to individual pages, allowing visitors to go through multiple paths to the site is
    9·1 answer
  • In order for Dr. Reynolds to send a CPOE from her office computer system to the computer system at the local hospital, a/an ____
    5·1 answer
  • You have just installed a SOHO router in a customer’s home and the owner has called you saying his son is complaining that Inter
    9·1 answer
  • How can the use of new technology in industry benefit the us government
    8·2 answers
  • Dose anyone know how to change username, grade level, and gender here? I have tried it in the change preferences and it says it
    8·2 answers
  • Who is the prince of math?
    5·2 answers
  • How can the system administrator give the executive assistant the ability to view, edit, and transfer ownership of all records,
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!