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 questions do they ask for the 08.03 Discussion- Based Assesment in Drivers Ed?? Thanks.
mel-nik [20]

When should my headlights be turned on?

Why shouldn't one take medication before driving?

Why must you use a turn signal?

I'm not sure about that last one because I forgot but I think its right.

6 0
4 years ago
Which year marked the arrival of private satellite television channels in India? Answer key - A)1982 B)1985 C)1991 D)1995
Lubov Fominskaja [6]
Up until 1991 there was only 1 public channel
4 0
3 years ago
What is the difference in the way computers store numeric data and non-numeric data?
Elan Coil [88]
Both numeric and non-numeric data have different ASCII codes, that will be the first difference. Second, numeric data are stored in float, double, and int variables while non-numeric data are stored in char. However, both can be stored in a String variable if and only if the desired data to be stored will not be used for computuation using mathematical operations such as addition.

To store a non-numeric data in an array, the array must first be declared as a String variable array while a numeric data can be stored in an array once the array which will store the numeric data is declared as an integer, double, or float variable.
3 0
3 years ago
Which component is responsible for collecting and consolidating data from network devices that are being monitored with snmp?
Tanzania [10]

Answer:

A storage area network (SAN) is a dedicated high-speed network or subnetwork that interconnects and presents shared pools of storage devices to multiple servers.

The availability and accessibility of storage are critical concerns for enterprise computing. Traditional direct-attached disk deployments within individual servers can be a simple and inexpensive option for many enterprise applications, but the disks -- and the vital data those disks contain -- are tied to the physical server across a dedicated interface, such as SAS. Modern enterprise computing often demands a much higher level of organization, flexibility and control. These needs drove the evolution of the storage area network (SAN).

SAN technology addresses advanced enterprise storage demands by providing a separate, dedicated, highly scalable high-performance network designed to interconnect a multitude of servers to an array of storage devices. The storage can then be organized and managed as cohesive pools or tiers. A SAN enables an organization to treat storage as a single collective resource that can also be centrally replicated and protected, while additional technologies, such as data deduplication and RAID, can optimize storage capacity and vastly improve storage resilience -- compared to traditional direct-attached storage (DAS).

SAN architecture

A storage area network consists of a fabric layer, host layer and storage layer.

6 0
2 years ago
Makes it possible to treat dates as other numbers
Vera_Pavlovna [14]
What do you mean?  <span>Makes it possible to treat dates as other numbers</span> 
8 0
3 years ago
Other questions:
  • How to be professional in graphic design without CAD?
    5·1 answer
  • My programming lab 9.2 C++ Write a full class definition for a class named Counter, and containing the following members:_______
    6·1 answer
  • Write a program to enter a number and test if it is greater than 45.6.if the number entered is greater than 45.6 the program nee
    13·1 answer
  • Mencione algunos ejemplos en donde sean utilizadas las máquinas de aire comprimido. Justifique su respuesta.
    7·1 answer
  • Sonja is writing a program to compare two numbers and print the larger number. Which of these should be used?
    6·1 answer
  • An array A[0..n - 2] contains `n-1` integers from 1 to `n` in increasing order. (Thus one integer in this range is missing.) Des
    11·1 answer
  • What are some real-life situations where multi-dimensional arrays might be useful?
    8·1 answer
  • You are writing a program using the Java language. Which of the following is a requirement of Java syntax?
    6·1 answer
  • Create a class called StockTester that has the following fucntionality. a. Create a main method with an ArrayList named dataStoc
    9·1 answer
  • Calculate the total resistance of this simple circuit. If R1 = 100Ω, R2 = 200Ω.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!