Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

problem 1: Write a program printFrequency.java that will take an integer array and number of elements that it stores as user input and will print

problem 1: Write a program printFrequency.java that will take an integer array and number of elements that it stores as user input and will print frequency of each element in the given array.

Sample Input: Enter length of array: 8 Enter element 0: 2 Enter element 1: 5 Enter element 2: 6 Enter element 3: 5 Enter element 4: 2 Enter element 5: 8 Enter element 6: 8 Enter element 7: 5 Enter element 8: 5 Sample Output: Element 2 has frequency: 2 Element 5 has frequency: 4 Element 6 has frequency: 1 Element 8 has frequency: 2

Problem 2: Write a program findMaxima.java that will take an integer array and number of elements that it stores as user input and will print all the Maximas. (NOTE: An element is a Maxima if it is greater than all the elements to its right side)

Sample Input: Enter length of array: 7 Enter element 0: 10 Enter element 1: 9 Enter element 2: 14 Enter element 3: 23 Enter element 4: 15 Enter element 5: 0 Enter element 6: 9 Sample Output: Maximas in the given array are: 23, 15, 9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Develop clear policy statements.

Answered: 1 week ago

Question

Draft a business plan.

Answered: 1 week ago

Question

Describe the guidelines for appropriate use of the direct plan.

Answered: 1 week ago