8. Repetition 1Use Pythón, Dont use any Built in f unction. Print, return can be used] Write a method that takes in an array as a parameter and counts the repetition of each element. That is, if an element has appeared in the array more than once, then its 'repetition' is its number of occurrences. The method returns true if there are at least two elements with the same number of 'repetition'. Otherwise, return false. Input: {4,5,6,6,4,3,6,4} Output: True Explanation: Two numbers repeat in this array: 4 and 6. 4 has a repetition of 3, 6 has a repetition of 3. Since two numbers have the same repetition output is True. Input: {3,4,6,3,4,7,4,6,8,6,6} Output: False Explanation: Three numbers repeat in this array:3,4 and 6 .3 has a repetition of 2, 4 has a repetition of 3, 6 has a repetition of 4. Since no two numbers have the same repetition output is False.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 9RQ
icon
Related questions
Question
100%
8. Repetition Use Python, Dont use any Built in f
unction. Print, return can be used]
Write a method that takes in an array as a
parameter and counts the repetition of
each element. That is, if an element has
6,
appeared in the array more than once, then
its 'repetition' is its number of occurrences.
The method returns true if there are at least
two elements with the same number of
'repetition'. Otherwise, return false.
Input: {4,5,6,6,4,3,6,4} Output: True
Explanation: Two numbers repeat in this
array: 4 and 6. 4 has a repetition of 3,
has a repetition of 3. Since two numbers
have the same repetition output is True.
6
Input: {3,4,6,3,4,7,4,6,8,6,6} Output: False
Explanation: Three numbers repeat in this
array:3,4 and 6.3 has a repetition of 2,
has a repetition of 3, 6 has a repetition of 4.
4
Since no two numbers have the same
repetition output is False.
Transcribed Image Text:8. Repetition Use Python, Dont use any Built in f unction. Print, return can be used] Write a method that takes in an array as a parameter and counts the repetition of each element. That is, if an element has 6, appeared in the array more than once, then its 'repetition' is its number of occurrences. The method returns true if there are at least two elements with the same number of 'repetition'. Otherwise, return false. Input: {4,5,6,6,4,3,6,4} Output: True Explanation: Two numbers repeat in this array: 4 and 6. 4 has a repetition of 3, has a repetition of 3. Since two numbers have the same repetition output is True. 6 Input: {3,4,6,3,4,7,4,6,8,6,6} Output: False Explanation: Three numbers repeat in this array:3,4 and 6.3 has a repetition of 2, has a repetition of 3, 6 has a repetition of 4. 4 Since no two numbers have the same repetition output is False.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT