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 airline has found about 7% of its passengers request vegetarian meals. On a flight with 166 passengers the airline has 16 veg
Ket [755]

Answer:

P(x >16.5) = 0.3372

Explanation:

Given data:

P = 0.07

n = 166

Available vegetarian  dinner is 16

let P(X\leq 16) is number of short vegetarian meals

P(X\leq  16)  = binomial distribution (166, 0.09)

np = 166\times 0.09 = 14.94

n(1-p) = 166(1-0.09) = 151.06

Both value of np and n(1-p) greater than 5

x -  normal distribution  with

mean  = np = 14.94

standard deviation= \sqrt{np(1-p)}

                                [/tex]= \sqrt{14.94(1-0.09)}[/tex]

standard deviation = 3.687

Find P(x> 16) i.e P(X>16 ) = P(x >16.5)

P(x >16.5) = 1 - P(x <16.5)

                = 1 - P(\frac{x-\mu}{\sigma} < \frac{16.5 - \mu}{\sigma}

         = 1 - P{Z < [\frac{16.5 - 14.94}{3.67}]

                = 1 - P{z< 0.425}

                 = 1 - 0.6628

P(x >16.5) = 0.3372

8 0
3 years ago
What is the value of the result after the following statement is executed? int result = 2 + 3 + 4 ;
kow [346]

2 + 3 + 4 = 9 so the value of result is also 9

8 0
2 years ago
. A program that can run more than one thread at once is called:
kap26 [50]

Answer: Multithreaded

Explanation: Multithreaded program is the program that has the capability of supporting multiple execution through one thread. The multiple execution through single thread refers to the instructions that can take place simultaneously in a sequence manner.

Every instruction in the execution is provided with their own control unit which helps in flow control.Individual execution flow that takes place in sequence of instruction is called threads

8 0
3 years ago
How ict tools changed the way we live explain it​
laiz [17]

Answer:

How does ICT change our way of living?

ICT has contributed a lot to change our everyday life such as letter to e-mail, market shopping to on-line shopping, classroom learning to e-learning, etc. This paper present's the effects of ICT as Home and Domestic Activities, Social Networking, Education, Health, Commerce, Banking, and Employment.

5 0
1 year ago
Enter a character: * ASCII #42 Enter a character: exit Not a character
Dima020 [189]

* ‎‎‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎

8 0
3 years ago
Other questions:
  • Processing is handled by the computer’s central processing unit (cpu).​ <br> a. True <br> b. False
    6·1 answer
  • What command would you use to list the text files in your
    7·1 answer
  • Explicit knowledge can be documented and codified, whereas tacit knowledge encompasses insights, judgment, creative processes, a
    9·1 answer
  • Computers help eliminate the repetitiveness of manual tasks. How can this benefit you in your overall career?
    9·2 answers
  • Match the job description to the level of degree it requires.
    15·1 answer
  • Fill in the blanks:<br>Can anyone help me out with this <br>​
    9·1 answer
  • JUST NEED TO KNOW WHO ALL DOSE EDGINUITY
    12·2 answers
  • What aspect should you consider before adding pictures to a document?
    6·1 answer
  • Question 1(Multiple Choice Worth 5 points)
    9·2 answers
  • In windows 10, where would you save the template so it is available in the available templates list in backstage view?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!