Ace school

with brainly

  • Get help from millions of students
  • Learn from experts with step-by-step explanations
  • Level-up by helping others

A community for students.

how can I write a program that gets a set of n integers from the user and tells them the frequency of each number. Ex: Input: 3. 7. 2. 5. 8. 1. 3. 5. 5. 8 Output: 1 1 2 1 3 2 5 3 7 1 8 2 mainly having problems with the searching aspect

Computer Science
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

In what computer language?
array of n numbers one entry for each number add one to the entry as the user inputs the number display entry name and number it holds
@ShadowZzz You can write your answer in pseudo code.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Definitely many ways to do this. A few come to mind. I'll use Python as the example language. 1. Append each entry to the list then run a list.count() command on each entry. (Of course you'd have to account for the multiple entries, maybe by sorting the list and only printing if the current entry is not the same as the one before it.) 2. Create a dictionary. If the entry does not exist in the dictionary, add it with the value of 0. If the entry does exist, increase the associated value by 1. 3. Variables. You could sort your list, and then create a "num_frequency" variable. Increment your variable by 1 when your list entries are duplicates. Display the variable and reset it when they aren't. Of course, not all approaches are equal. But this at least shows a number of ways to approach the problem.
I'm working in Java. I was thinking of using a nested for loop but i cant really figure out exactly what to do

Not the answer you are looking for?

Search for more explanations.

Ask your own question