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
What do you call the spreadsheet cell that is in effect and has a heavier black border around it?
valina [46]
The right answer is A<span>.Active cell </span>
4 0
3 years ago
Read 2 more answers
________ is a suite of protocols designed to connect sites securely using ip networks.
a_sh-v [17]
IPSec


Hope that helps, Good luck!! (:
7 0
4 years ago
Read 2 more answers
If you inadvertently rename a file that is associated with certain apps, the apps may not be able to find the file and may not r
ad-work [718]
No.... This wont happen.... The computer only renames the file and dont let those apps go....in easy words We can say that the comp tells the apps to stay here...
7 0
3 years ago
Read 2 more answers
The two major types of system software programs are utility programs and the ________. Select one: A. user interface B. supervis
Scrat [10]

Answer:

operating system

Explanation:

System software are those programs that many refer to as computer programs. The most basic function of system software is to manage the computer systems. It acts as an interface between the computer’s hardware and the end user. System software converts instructions that end users give to the computer into a machine understandable language. Examples of system software include operating systems, utility programs, device drivers, and windows systems. The operating system is responsible for the functioning of all the computer’s hardware parts. It is the software loaded into the system when the computer boots up. It manages everything, from the memory, to the CPU, and many other different tasks.

8 0
3 years ago
Which icon is greater in file size? (Show your working)
nadya68 [22]

Answer:

the 256 color icon would be greater in file size.

Explanation:

regardless of how many pixels are in the image, file A has 256 colors meaning the computer has to individually load each one of those colors. it'll probably use a lot of ink if you decide to print it, too.

5 0
3 years ago
Other questions:
  • Which command compiles the java source code file welcome.java?
    9·1 answer
  • Does the cloud solution offer equal or greater data security capabilities than those pro-vided by your organization’s data cente
    14·1 answer
  • 7.1 What is the basic building block of an 802.11 WLAN? 7.2 Define an extended service set. 7.3 List and briefly define IEEE 802
    5·1 answer
  • A(n) ________ is a navigation aid that shows the path you have taken to get to a web page or where the page is located within th
    5·2 answers
  • If i'm watching a show on netflix without any extra speakers besides the normal one on my tv, what setting should i use? English
    11·2 answers
  • Someone places a chocolate bar near a working radar set that is used to locate ships and airplanes. Which best describes what is
    15·2 answers
  • X333: countElements Given an array of integers and an integer target, return a count of the number of times the target value occ
    6·1 answer
  • For the second one just answer what game engines are please, you don't have to explain.
    8·1 answer
  • Which html tag designates links to other web pages?.
    15·1 answer
  • Say true or false. a)ICT in education is used as teaching learning aid
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!