Results 1 to 1 of 1

Thread: Little Array Problem

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2004
    Posts
    1

    Little Array Problem

    What I am trying to do is to increase the number of rows in an array, (array1), by using another array, (array2) to provide an element position pointer to a column in array1, the value at this position is moved into a sequential position on a new row. I don't think i've explained that terribly well, below is an example. I am using 2d arrays (although they are not shown, it just gives an idea of how the program is supposed to work).

    Looking at the Output first, array1(0) and array1(1) are the same as the original, array1(2) is generated by: array2(0), element1 = 4...get the number from array1(0) element 4 which is 11, put this 11 in the first column of array1(2). The next element in array2(0) is 1, get the element 1 from array1(0)= 5, this goes into position 2 of array1(2).

    Basically, the array2 is an nth position pointer to array1(),


    Def1:
    array1(0) = {5,23,9,11,34...} ' Original
    array1(1) = {19,6,5,14,29...} ' Original

    Def2:
    array2(0) = {4,1,3,5,2...} ' these are position pointers to the elements of a row
    array2(1) = {3,4,5,1,2...} ' in array1

    Output:
    array1(0) = {5,23,9,11,34...} ' Original
    array1(1) = {19,6,5,14,29...} ' Original
    array1(2) = {11,5,9,34,23...} ' Using array2(0) on array1(0)
    array1(3) = {14,19,5,29,6...} ' Using array2(0) on array1(1)
    array1(4) = {9,11,34,5,23...} ' Using array2(1) on array1(0)
    array1(5) = {5,14,29,19,6...} ' Using array2(1) on array1(1)
    array1(6) = {9,34,23,11,5...} ' Using array2(1) on array1(2)
    array1(7) = {5,29,6,14,19...} ' Using array2(1) on array1(3)

    This continues until all each row in array2() has been applied to the ever growing list of rows in array1(). Each iteration of array2 will give a growth in array1 of ^2.

    Anyway, the guts of the program is attached, I'm just not quite getting the output results I expect, namely, not always enough rows, does it look correct, if so I guess I may have a pointer problem.

    Any help would be appreciated....Many thanks in advance, and sorry about the length of this post.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width