Question: Task 4 . In order to handle the case that no existing indices a & b can reduce the number of breakpoints, we need to

Task 4. In order to handle the case that no existing indices a & b can reduce the number of breakpoints, we need to reverse an increasing strip. We need implement the following function:
find_increasing_strip(data)function implementation
Under an assumption that the entire sequence is composed of increasing strips, you are to identify the indices a and b that define the second of those strips (that is, the one after that which starts with 0). For example, a call to
find_increasing_strip[0,1,2,5,6,7,3,4,8])
should return the index pair (3,5) because those indices identify the extent of the strip holding values 5,6,7.
Note: This function is only triggered in a special case when there is no way to do a reversal that fixes a breakpoint (which implies that there are no decreasing strips). Since we pick random shuffles by default, it may be that some execution of the program trigger this function, while others do not. So you might get lucky and solve the problem even before implementing this function properly. But you should test on some cases that do trigger this function.
def find_increasing_strip(data): """Return [a,b] defining the second increasing strip (presuming there are two or more such strips)."""
Test your function in the following examples:
[0,1,2,6,5,3,4,7]
[0,1,5,6,2,3,4,7]
[0,1,6,5,8,7,2,3,4,9]

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!