Hello to everybody. I am an old research student in management and it has been 15 years since I last did any programming (it was in high school). Needless to say, it is taking me forever to learn C++, so I was wondering if somebody could kindly help me out.
I need a code (that will work in Dev-C++) that does the following:
1) user enters an integer N
2) computer generates a matrix 2^N (rows) by N (columns) such that rows only consist of 0 and 1 (of course all rows are different, i.e. orthogonal)
The algorithm I have in mind is as follows:
1) run a loop for "i" from 1 to N (or from 0 to N-1)
2) for every given "i" run a loop for "j" that goes from 1 to 2^(N-i)
3) for every given "j" run a loop for "k" that goes from 1 to 2^(i-1)
4) for every given "k" assign k consequtive zeros and k consequtive ones in the column (until the column is filled)
Notice that the first column goes "01010101...", the second one goes "00110011...", the third one "000111000111...", etc. The final N-th column will have only zeros in the upper half followed by only ones in its lower half.
Not sure if you are barking up the wrong tree. Is the output in your original post part of the specification? Normally permuting all the binary values would look something like: