Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using javascript 03. Write pseudocode for a single function called extremeValues. It takes 1 parameter, an array of integers (you do not need to validate

image text in transcribedusing javascript

03. Write pseudocode for a single function called extremeValues. It takes 1 parameter, an array of integers (you do not need to validate this). The function should return the minimum AND maximum values in the array. The standard approach for finding a minimum value in an array is to assume the first element (at index 0) is the current minimum. Then process the array repetitively from its second element to its last. On each iteration compare the current element being processed with the current minimum. If it's less than the minimum then set it as the current minimum. In this way at the end of processing the current minimum holds the minimum element value in the array. A similar process will work for finding the maximum. 04. Using your pseudocode from the previous task, now code your function so that it prints to the output area, the smallest and largest elements in the array. For example the following array: Var values = [4, 3, 6, 12, 1, 3, 8]; would show the following output: 12 1

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

Step: 3

blur-text-image

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

Students also viewed these Databases questions