| Author |
doubt in code
|
aditya miduthuru
Greenhorn
Joined: Nov 28, 2012
Posts: 1
|
|
how can we write a code for transpose of a matrix with only one array and that too for non-symmetric array???
Help me up we are trying to do in c but not able write a logic
|
 |
Praveen Kumar M K
Ranch Hand
Joined: Jul 03, 2011
Posts: 256
|
|
Well considering that you have an array(which in actuality is an array of arrays) you want to write a program to convert from Ain to Aout on the same array. Hope I got that right.
Ain =
[
1 2 3
4 5 6
]
Aout =
[
1 4
2 5
3 6
]
It is not possible either in C or in Java to convert a 2x3 array to 3x2. A single array's dimensions and capacity are fixed during compile time and you cannot change that programmatically.
You can take an input array, create an output array(with dimensions switched) and then iterate and fill the output array.
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9939
|
|
|
I would suggest you work it out by hand first. Write down the directions, in English (or any other natural language), that a 10 year old child can understand. Once you have that, writing the code is a lot simpler.
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
 |
|
|
subject: doubt in code
|
|
|