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
yKpoI14uk [10]
3 years ago
10

Package hw1;

Computers and Technology
1 answer:
kotykmax [81]3 years ago
3 0

Answer:

The Java code is given below with appropriate comments in key areas of the code

Explanation:

import java.util.TreeMap;

public class HW1 {

       /**

        * Inverts an array of Strings by returning a TreeMap that maps Strings to the

        * smallest index in the array that contains the String.

        *

        * @param a an array of Strings

        * @return a Map that given a String returns the smallest index of the array

        *         that contains the String (or null if String is not in the array a).

        */

       public static TreeMap<String, Integer> invert(String[] a) {

               TreeMap<String, Integer> tmap = new TreeMap<>();

               for (int i = 0; i < a.length; i++) {

                       if (!tmap.containsKey(a[i])) {

                               tmap.put(a[i], i);

                       }

               }

               return tmap;

       }

       /**

        * Computes the total number of occurrences of every String in an array.

        *

        * @param a an array of Strings

        * @return a Map that given a String returns the number of occurrences of that

        *         String in the array (or null if String is not in the array a).

        */

       public static TreeMap<String, Integer> count(String[] a) {

               TreeMap<String, Integer> tmap = new TreeMap<>();

               for (int i = 0; i < a.length; i++) {

                       tmap.put(a[i], 1 + tmap.getOrDefault(a[i], 0));

               }

               return tmap;

       }

}

You might be interested in
If your attack seems unsuccessful, one thing that you can investigate is whether the SYN cookie mechanism is turned on. SYN cook
kykrilka [37]

Answer:

suds systolic -a I believe

Explanation:

5 0
4 years ago
Why should electronics be allowed in school
dedylja [7]

Answer:

It can help kids with stimulation and it can also help them learn more. also in case of an emergency, kids will be able to reach the authorities easier

6 0
3 years ago
To use the styles in an external style sheet, you can drag and drop the style sheet file into the head section of the aspx file
Neporo4naja [7]

Answer:

False

Explanation:

Cascading style sheet (CSS) is a web development tools used to create web pages. They give style or determine how a HTML file is a parse in a web browser.

There are three ways of adding CSS to a HTML file. First is the inline css, in which the styles of an element in the HTML file is described in that element tag. The second is using the style element in the HTML file to create css for elements in the file.

The third is external CSS file. The CSS file is created and linked to the HTML file through the link element in the head tag.

4 0
3 years ago
You have a Windows 2016 Server with DFS. During normal operation, you recently experience an Event 4208. What should you do firs
Anna007 [38]

Answer: Increase your staging folder quota by 20%

Explanation:

The Distributed File System (DFS) allows the grouping of shares on multiple servers. Also, it allows the linking of shares into a single hierarchical namespace.

Since there's a Windows 2016 Server with DFS and during normal operation, an Event 4208 was experienced, the best thing to do in order to address the issue is to increase the staging folder quota by 20%.

6 0
3 years ago
Which of the following is an example of a logic error?
Mumz [18]

Answer:

Receiving unexpected results from a program

Explanation:

Logic errors are due to the program not producing a desired result.

5 0
3 years ago
Read 2 more answers
Other questions:
  • In python:
    14·1 answer
  • If you’re trying to reduce your debt, which of these expenses should you consider cutting out or cutting back on first?
    5·2 answers
  • What will the following segment of code output? Assume the user enters a grade of 90 from the keyboard. cout &lt;&lt; "Enter a t
    5·1 answer
  • Who designed the apple i computer in 1976?
    7·2 answers
  • A cookie filter blocks the sending and receiving of cookies. Blocking cookies can reduce some threats of session tracking and id
    12·1 answer
  • What was the first video game ever invented
    11·2 answers
  • Suppose you begin with an empty binary search tree, and want to add all the positive integers from 1 through 31 to the tree. If
    5·1 answer
  • Which of the following statements is false?
    15·1 answer
  • What is the difference between a threat and an attack?
    7·1 answer
  • Is windows CUI operating system??<br><br><br>What is the main purpose of folder ????<br><br><br>​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!