ankur237518
| Subject: comp question Mon Feb 21, 2011 1:39 pm | |
| Write the program to do the following: Read in an integer n (which can be at most 50). Then read in n integers one by one and store them in an array data from index 0 to n-1. Now we want to rearrange the integers in data in the following way : Find the maximum value in data and put in the centre of the array (that is at (n/2); find the next largest value and put it to its right; then the next largest and place it to its left and so on alternating right and left until all integers in data are done. For example, if the array is initially: 7, 3, 1, 6, 4, 2, 5 then after rearranging it becomes 1, 3, 5, 7, 6, 4, 2 However, since we have very little memory, you are not allowed to use any other array from data |
|
arauf487
| Subject: Re: comp question Mon Feb 21, 2011 1:47 pm | |
| Thanks for the question...but is it a guess question ?? And can you please provide the code for the program. |
|
ankur237518
| Subject: Re: comp question Mon Feb 21, 2011 2:05 pm | |
| looking for soln myself |
|
arauf487
| Subject: Is it an important question...or just for practise ?? Mon Feb 21, 2011 2:14 pm | |
| - ankur237518 wrote:
- looking for soln myself
Is it an important question...or just for practise ?? |
|
ankur237518
| Subject: Re: comp question Mon Feb 21, 2011 2:41 pm | |
| it has a huge chance of coming this time. |
|
arauf487
| Subject: thanks Mon Feb 21, 2011 2:43 pm | |
| - ankur237518 wrote:
- it has a huge chance of coming this time.
That's good...thanks !
|
|
Sponsored content
| Subject: Re: comp question | |
|
|
|