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
Swapping Order of Vowels Write a program to swap the order of the vowels in a given word. For example, if the word is programmin
Georgia [21]

Answer:

Program is as follow:

Explanation:

#include<iostream.h>

#include < conio.h>

bool isVowel(char b)

{

return

( b=='a' || b=='A' || b=='e' || b=='E' || b=='i' || b=='I' || b=='o' || b=='O' || b== 'u' || b=='U');

For swaoing the vowels

string reverseVowel ( String str)

{

int j = 0;

string v ;

for ( int i= 0 ; str [i]]!='0'; i++)

if( isv(str[i]))

v[j++] = str[i[;

for ( int i = 0; str[i]! = '0' ; i++

if ( isv (str[i]))

str{i} = v [--j]

return str;

}

int main ()

{ string str = " Programming";

cout<<swapv(str);

return 0 ;

}

7 0
3 years ago
In which career field, would the Computing Technology Industry Association's CompTIA A+ certification be useful?
Anna [14]
It's geared towards system administration but would also be useful for devops.
5 0
4 years ago
The multitasking, multi-user, operating system developed by Bell Laboratories that operates on a wide variety of computing platf
olasank [31]

Answer:

Unix

Explanation:

UNIX is simply an operating system developed by Bell Laboratories in the 1960s. Ever since then, it has been constantly worked upon and developed. It is an operating system because it is a suite of programs capable of making a computer to function. Unix is considered to be a stable, multi-user, and multi-tasking system for both desktops and laptops and even servers.

8 0
3 years ago
Select the correct answer.
Marina86 [1]
C: pie chart is the answer to it
4 0
3 years ago
Read 2 more answers
What are the methods of identifying publicly switched networks?
Sav [38]
I believe that the answer to the question provided above is that the <span> methods of identifying publicly switched networks is by locating the IP address if the source.</span>
Hope my answer would be a great help for you.    If you have more questions feel free to ask here at Brainly.

8 0
3 years ago
Other questions:
  • Write a script that will generate random integers in the range from
    10·1 answer
  • Which of the following is an example of new and emerging classes of software?
    11·2 answers
  • Which resource do programmers sometimes have to refer to and use during planning the logical steps of the solution?
    10·2 answers
  • Which Google Analytics visualization compares report data to the website average?A. Pivot viewB. Comparison viewC. Performance v
    8·1 answer
  • a problem-solving approach that requires defining the scope of a system, dividing it into its components, and then identifying a
    8·1 answer
  • How can you create the first row of the table as the header of the table?
    8·1 answer
  • Create a winform application that lets the user enter a temperature. With a ComboBox object offer the user three choices for inp
    9·1 answer
  • Is the internet a private place?
    15·2 answers
  • Which formatting options can be changed by selecting the Design tab? Check all that apply.
    7·2 answers
  • 1. What are the main uses for Protein in the body?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!