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
astraxan [27]
3 years ago
8

Please write a Java program.

Computers and Technology
1 answer:
Marianna [84]3 years ago
5 0

Answer:

public class Main

{

public static void main(String[] args) {

 int[] arr = {3, 1, 1, 2, 4, 4, 4, 6};

 

 int[] o = countOccurance(arr);

 for (int x: o)

     System.out.print(x + " ");

}

public static int[] countOccurance(int[] arr){

    int[] occ = new int[6];

    for (int x: arr)

        occ[x-1]++;

   

    return occ;

}

}

Explanation:

Create a function called countOccurance that takes one parameter, an array

Inside the function, initialize an array, occ, to hold the occurance counts

Create a for each loop to iterate the array, and increment the occurance of the numbers

When the loop is done, return the occ array

Inside the main, initialize an array

Call the function countOccurance and set it to a new array, o

Print the elements of the o to see the number of occurances of the numbers

You might be interested in
For some reason i cant see brainly answers
denis23 [38]

Answer:

Same thing happening to me and several other people. At this point I wonder if there site is having troubles. I tried to email them but even that is not working.

Explanation:.

4 0
3 years ago
Which recovery method allows users to back up their personal files to an external drive or network share without administrative
GarryVolchara [31]

Answer:

File history

Explanation:

File history recovery method  allows users to back up their personal files to an external drive or network share without administrative assistance. File History is a backup program that holds your personal files saved in the directories archives, desktop, favorites, and Contacts. It searches the file system regularly for changes, and copies modified files to a different location.

8 0
3 years ago
Suppose we compute a depth-first search tree rooted at u and obtain a tree t that includes all nodes of g.
Temka [501]

G is a tree, per node has a special path from the root. So, both BFS and DFS have the exact tree, and the tree is the exact as G.

<h3>What are DFS and BFS?</h3>

An algorithm for navigating or examining tree or graph data structures is called depth-first search. The algorithm moves as far as it can along each branch before turning around, starting at the root node.

The breadth-first search strategy can be used to look for a node in a tree data structure that has a specific property. Before moving on to the nodes at the next depth level, it begins at the root of the tree and investigates every node there.

First, we reveal that G exists a tree when both BFS-tree and DFS-tree are exact.

If G and T are not exact, then there should exist a border e(u, v) in G, that does not belong to T.

In such a case:

- in the DFS tree, one of u or v, should be a prototype of the other.

- in the BFS tree, u and v can differ by only one level.

Since, both DFS-tree and BFS-tree are the very tree T,

it follows that one of u and v should be a prototype of the other and they can discuss by only one party.

This means that the border joining them must be in T.

So, there can not be any limits in G which are not in T.

In the two-part of evidence:

Since G is a tree, per node has a special path from the root. So, both BFS and DFS have the exact tree, and the tree is the exact as G.

The complete question is:

We have a connected graph G = (V, E), and a specific vertex u ∈ V.

Suppose we compute a depth-first search tree rooted at u, and obtain a tree T that includes all nodes of G.

Suppose we then compute a breadth-first search tree rooted at u, and obtain the same tree T.

Prove that G = T. (In other words, if T is both a depth-first search tree and a breadth-first search tree rooted at u, then G cannot contain any edges that do not belong to T.)

To learn more about  DFS and BFS, refer to:

brainly.com/question/13014003

#SPJ4

5 0
2 years ago
Question very important cause after my school is over at 5 'oclock I will be playing rocket league if anyone wants to play just
jarptica [38.1K]

Answer:

So can u tell me wut is ur question...It is not understandable

6 0
2 years ago
Do all the OSs provide support for multiprocessing?
Zigmanuir [339]

Answer: No, not all the OSs provides facilitation working with multiprocessor.

Explanation: Multiprocessing is the executing different tasks at the same point of time within a system through two or more processors. Multiprocessing is not supported by the single processor operating system(OS) .

Single processor system cannot operate several tasks at the same time and cannot run the processes simultaneously.But, most of the modern operating system are designed in a way that it can support multiprocessing.

4 0
3 years ago
Other questions:
  • Explain the term computer output​
    8·1 answer
  • 1. What words might you add to the Microsoft spelling dictionary?
    10·1 answer
  • What is the financial aspect for a business as to what database software they will buy?
    6·1 answer
  • Which guideline should you follow when selecting the font for a presentation
    9·1 answer
  • Convert octal number 2470 to decimal number
    14·2 answers
  • highlight the possible risks and problems that should be address during the implementation of information system process
    5·1 answer
  • _____the measuring instrument is not necssery​
    10·1 answer
  • Def pig_latin(word): """ ------------------------------------------------------- Converts a word to Pig Latin. The conversion is
    15·1 answer
  • . Question 2 Fill in the blank: R Markdown notebooks can be converted into HTML, PDF, and Word documents, slide presentations, a
    9·1 answer
  • marion is an iot developer working for a large organization. why does his supervisor want him to stay informed about the network
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!