**Odd-Even Merging Circuit**

Let's firstly understand the idea of merging two sorted sequences using an odd-even merging circuit. The functioning of a merging circuit is as given below:

1) Let there be 2 sorted sequences A= (a_{1}, a_{2}, a_{3}, a_{4}......... a_{m}) and B= (b_{1}, b_{2}, b_{3}, b_{4}......... b_{m}) that are needed to be merged.

2) With help of a merging circuit (m/2, m/2) merge the odd indexed numbers of two sub sequences it implies that (a_{1}, a_{3}, a_{5}......... a_{m-1}) and (b_{1}, b_{3}, b_{5}......... b_{m-1}) and so resulting in sorted sequence (c_{1}, c_{2}, c_{3}......... c_{m}).

3) Afterwards, with the help of a merging circuit (m/2, m/2) merge the even indexed numbers of the two sub sequences it implies that (a_{2}, a_{4}, a_{6}......... a_{m}) and (b_{2}, b_{4}, b_{6}......... b_{m}) and so resulting in sorted sequence (d_{1}, d_{2}, d_{3}......... d_{m}).

4) The last output sequence O= (o_{1}, o_{2}, o_{3}......... o_{2m}) is attained in the given below manner: o1 = a1 and o2m = bm .In broad the formula is as following: o2i = min (ai+1, bi) and o2I+1 = max(ai+1,bi ) for i=1,2,3,4..........m-1.

Now let's take an illustration for merging the 2 sorted sequences of length 4 it implies that A= (a1, a2, a3, a4) and B= (b1, b2, b3, b4). Assume numbers of sequence are A= (4, 6, 9, 10) And B= (2, 7, 8, 12). The circuit of merging the two provided sequences is explained in Figure.

**Figure: Merging Circuit**