Question: ( 8 points ) Write an algorithm that inputs a number n followed by an array of n numbers a 1 , a 2 ,

(8 points) Write an algorithm that inputs a number n followed by an array of n numbers
a1,a2,dots,an and outputs the number of values of i, with i between 1 and n-1 such that
|):}1in-1n=82,4,5,7,1,8,4,324,45,5718n=510,9,8,4,1n=710,5,3,12,2,-10,-100i=3312n=1080,40,20,19,10,50,12,14,1,221050,1214122a3 which is312.
Example 4:
Input: n=10 and the array of10 numbers is80,40,20,19,10,50,12,14,1,22
Output: 3
Why is output 3? Because moving left to right the there are 3 positions where it goes up,
1050,1214, and 122.
( 8 points ) Write an algorithm that inputs a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!