Question: A list L is called stepIncrease if the second element of L is larger than the first element in L, the fourth element is larger

A list L is called stepIncrease if the second element of L is larger than the first element in L, the fourth element is larger than the third element, the sixth element is larger than the fifth element,...(you can assume than the list L has an even number of elements). For instance:

L1 = [ 1, 21, 8,19, 4, 10, 8, 12] is a stepIncrease list

L2 = [ 4, 8, 12, 15, 3, 7, 1, 4, 8, 11] is a stepIncrease list

L2 = [ 4, 8, 15, 12, 3, 7, 1, 4, 8, 11] is not a stepIncrease list

a.Write a reduce-and-conquer recursive function stepIncreaseList(float L[], int n) (C++ or python) that determines whether a list (array) L of n real(float) number is a stepIncrease list or not.

b.Using comparison of float numbers > or < as a basic operation, set up and solve a recurrence relationship to compute the complexity of your code, as a function of the size nof the list (array).

Need it ASAP

Thanh you

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 Databases Questions!