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
serious [3.7K]
3 years ago
15

Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters.

Otherwise, it should return False.
Implement has_duplicates by creating a histogram using the histogram function above. Do not use any of the implementations of has_duplicates that are given in your textbook. Instead, your implementation should use the counts in the histogram to decide if there are any duplicates.

Write a loop over the strings in the provided test_dups list. Print each string in the list and whether or not it has any duplicates based on the return value of has_duplicates for that string. For example, the output for "aaa" and "abc" would be the following.

aaa has duplicates
abc has no duplicates

Print a line like one of the above for each of the strings in test_dups.
Computers and Technology
1 answer:
NNADVOKAT [17]3 years ago
3 0

public static bool has_Duplicates(string str)

       {

           str = str.ToLower(); // Lowercase all the items, makes them easier to sort

           int length = str.Length; // Get the length to apply to array

                                   

           char[] strArray = str.ToCharArray();

           // Turn to a character array

           Array.Sort(strArray);

           // Sort for speed and for method loop to work

           // Begin for loop to sort through letters

           for (int i = 0; i < length - 1; i++)

           {

               if (strArray[i] == strArray[i + 1])

               {

                   //if letter equals next letter, False

                   Console.WriteLine(str + "has duplicates");

                   return false;

               }

           }

           // if letter != next letter, Pass as True

           Console.WriteLine(str + "has no duplicates");

           return true;

       }

You might be interested in
Utilizando o padrão de medidas e unidades do National Institute of Standards and Technology, em que 1 KB é igual a 1.000 Bytes,
Tanya [424]

Segundo o padrão da  National Institute of Standards and Technology a  alternativa correta é a letra E) 400 músicas.  Segundo o padrão disposto acima, dois Giga Bytes equivalem à dois mil Mega Bytes, assim, se cada música tem exatos 5MB, podemos chegar ao total de músicas que podem ser gravadas em um PenDrive de 2GB livres do seguinte modo :

x=\frac{2000 MB}{5MB};x=400

 A evolução da microeletrônica possibilitou uma capacidade de armazenamento cada vez maior a cada ano. O desenvolvimento de novas tecnologias na área permite também que os produtores possam produzir músicas, fotos e vídeos com cada vez mais qualidade (consequentemente mais pesada).

5 0
2 years ago
Gini is a manager at a website design firm. She has a timeline prepared for the product to be delivered to the client. She needs
Grace [21]

Answer:

The correct answer is letter "A": controlling.

Explanation:

There are four (4) basic management skills: <em>Planning, Controlling, Organizing, </em>and <em>Leading.  </em>

Controlling implies reviewing the objectives the firm has established to evaluate the progress. It also involves measuring the resources the firm has available for reaching its goals and verifying if they will be enough to get to the finish line, otherwise, the company should find more efficient forms of allocating resources and funding its operations.

In other words, <em>the controlling skill of management sets the standards of performance within the institution.</em>

7 0
3 years ago
Read 2 more answers
Applying what formatting option to your excel workbook will make it easier to read when printed out?
blagie [28]
Portrait, as well as 100 percent scale.
8 0
3 years ago
Which of the following is not a basic networking hardware component? Network interface card
RideAnS [48]

Answer:

Device Driver

Explanation:

All of the other options are physical and are something that you can physically touch. The device driver runs in software and allows the computer to communicate with the device that is attached.

4 0
3 years ago
WHICH IS THE BEST EXAMPLA OF AI IN EDUCATION?
amm1812
An education is when you go to school and learn about certain topics and litature
7 0
3 years ago
Other questions:
  • Trevor got home from work and suddenly realized that he needed to edit a certain file stored in the company network's server. ho
    11·1 answer
  • HELP PLEASE
    7·2 answers
  • HURRY UP NEED HELP!!! What are examples of curricular education? Check all that apply.
    9·2 answers
  • Once you select select a crop boundary, you can no
    15·1 answer
  • Which small-group format would be most appropriate for the following situation? A large sporting event is coming to town. Key me
    14·2 answers
  • During the weekend, Alice often needs to access files stored on her office desktop from her home laptop. Last week, she installe
    15·1 answer
  • You can use colors, patterns, and borders to enhance the overall appearance of a worksheet and to make it easier to read. One of
    11·1 answer
  • Please answer me fast ​
    6·2 answers
  • Write short notes about monitor printer and speaker​
    14·2 answers
  • Add me on Fortn!te <br> TsarBacon (imma girl)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!