Answered step by step
Verified Expert Solution
Question
1 Approved Answer
algs 11 eclipse java * minCount returns the number of values in the array that are equal to the minimum * Precondition: the array is
algs 11 eclipse java
* minCount returns the number of values in the array that are equal to the minimum * Precondition: the array is nonempty. * Here are some examples (using "==" informally):1 == minCount (new double[] { -7 }) 2 == minCount (new double[] { 1, 7, 1, 11 }) 1 == minCount (new double[] { 5, 4, 3, 2, 1 }) 3 == minCount (new double[] { 4, 5, 4, 6, 4, 10 }) 5 == minCount (new double[] { 4, 4, 4, 4, 4 }) * The code below is a stub version, you should replace the line of code * labeled TODO with code that achieves the above specification **/ public static int minCount (double[] list) { return -1; //TODO 1: fix this /** * posofSmallestElementGt0eT returns the position of the smallest element in the array that * is greater than or equal to the limit parameter * if all values are smaller than theVal, return -1; * Precondition: the array is nonempty and all elements are unique. * Your solution may go through the array exactly once.
O == posofSmallestElementGt0eT(3, new double[] { 7 }) 5 == posofSmallestElementGt0eT(3, new double[] { 11, -4, -7, 4, 8, 1 }), -1 == pos0fSmallestElementGt0eT(17, new double[] { 1, -4, -5, 7, 8, 11 }), // all elements are */ public static int posofSmallestElementGt0eT( double limit, double[] list) { return -2; //TODO 2: fix this
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started