Wednesday, July 18, 2018

We were discussing software versions and the ideal conditions for maintaining earlier releases. The reality is usually far from this ideal situation. Although continuous deployment may be available, generally software releases are at least months apart if not years apart. Such long development cycles leaves significant number of fixes made to earlier versions Customers may also be sticky to earlier versions as they wait for early adopters to try out the new releases. The long development cycles imply that there is quite a divergence between earlier versions and current release. This divergence is the source of several backward compatibility issues and takes significant toll on testing and suitable fixes in the wake of new development. This further prolongs the development cycle. Even as the features are developed in their own branches, a significant amount of time may go into pulling and pushing the parent branches to build the feature on the latest. More time is spent on conflicts, merges and bug fixes that demand resources and the time for development, These eat up into the  resources otherwise reserved for helpful features for customers such as Command line interface (CLI), user interface (UI), software development kit (SDK) and API documentation. As corners are cut, features may not  have the impact that they would otherwise do. One way to relieve this development on large code bases with lengthy development cycles is to create multiple phases of feature development so that the forking and merging are more frequent.

#codingexercise
Let us say we are given three values N, M and X.
N = number of elements in an array
M = the upper maximum any element can be. If A is the array 1 <= A[i] <= M where 0 <= i <= N-1
X = the value of the first element
The number 1 = the value of the last element
How many ways are there such that the adjacent elements are distinct ?
Let us think about this in recurrence form with say f(i) as the desired number of ways for array to be formed up to index i. Then the index i could be occupied by 1 or a non - one .
For the non-one case, there would M-1 choices after finding f(i-1) and ending with 1 at i
                            and there would be M-2 choices after finding f(i-1) and ending with non-one at i excluding the 1 and the non-zero value at i
Also since adjacents have to be distinct f(i) ending with 1 is the same as f(i-1) ending with non-one.
The solution is f(N-1) ending in 1.
Finally we know that we don't have to include the first element since its value is predetermined.  The first element cannot be 1 and there is at most1 value in the range 1 to M at which the second element will form a duplicate with the first.
For N = 4, M  = 3, X = 2
we have possible arrays by enumeration as [2, 1, 2, 1],  [2, 1, 3, 1] and [2, 3, 2, 1]

In these case there are three arrays possible.

No comments:

Post a Comment