15,902,032 members
1.00/5 (1 vote)
See more:
Suppose there is an array of numbers
{s 1 ,s 2 ,....,s n ,,......,t 1 ,t 2 ,....,t n }
you have to implement the code in C such that you will get the result
{s 1 , t 1 , s 2 , t 2 , ...., s n , t n }
using divide and conquer concept.

Example: INPUT- {1,2,3,4,5,6}
OUTPUT-{1,4,2,5,3,6}

What I have tried:

Posted
Updated 23-Mar-18 4:14am
Patrice T 23-Mar-18 11:26am
Show your code, even if partial and explain where you are stuck
Richard Deeming 23-Mar-18 12:44pm
"you have to implement the code in C ..."

The key word in that homework assignment being YOU.

YOU have to implement the code. Not some random strangers on the internet.

If you don't know where to start, then talk to your teacher.

## Solution 1

The assignment is not "about dividing into odd and even entries".

Compare the input and output definitions (not the numerical examples) to find out which algorithm is used:
The first element of the output array is the first element of the input array (s1).
The second element of the output array is the ??? element of the input array (t1).

Then you might recognise that the sentence
Quote:
... every algorithm that uses recursion or loops could be regarded as a "divide and conquer algorithm".
might apply here.