Search:

Type: Posts; User: The Witchking

Search: Search took 0.32 seconds.

  1. Re: Support Needed - Populating a 2d matrix with different binary number representations.

    I had a typo in the inner loop, fixed. However,
    int n=Math.sqrt(matrix.length)
    doesn't compile.
  2. Re: Support Needed - Populating a 2d matrix with different binary number representations.

    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
    at Draft.toArray(Draft.java:215)
    at Draft.main(Draft.java:247)

    is given. also, can i use math.sqrt(x) on int[]...
  3. Re: Support Needed - Populating a 2d matrix with different binary number representations.

    ill use a counter inside the loops to track the array index.

    for array back to matrix i think this would work

    array[i]----goes to---->matrix[i/n][i%2]

    n is always even and array size is n^2....
  4. Re: Support Needed - Populating a 2d matrix with different binary number representations.

    for a matrix nxn ill create a new array n^2 long. how though would i index m[i][j] in a lop into its respective slot array[k]?
  5. Re: Support Needed - Populating a 2d matrix with different binary number representations.

    Yes, you are right, it would fold that way. However, the function I am trying to get will receive a 2d matrix. I need to apply the changes for it. since i do have a properly working function for a 1d...
  6. Re: Support Needed - Populating a 2d matrix with different binary number representations.

    I will attach here the following function, proven to work:
    The function will get an array representing a binary number. It will increment this number to the next larger binary number with the exact...
  7. Re: Support Needed - Populating a 2d matrix with different binary number representations.

    I can not find a better solution, that is why I am here for, to consult and draw on your experience.
    I will attach the following function code that increments a binary number represented in a 1d...
  8. Re: Support Needed - Populating a 2d matrix with different binary number representations.

    :) Now was an hour ago. Later is now. I would like to improve it. But hey, I just don't know how.
    My thanks for the correspondence tho, I did made me realize at least one possible solution,...
  9. Re: Support Needed - Populating a 2d matrix with different binary number representations.

    Is there no other way?
    The word of a seasoned programmer would be enough for me to settle for the above mentioned solution and stop trying something more efficient.
    Thank you.
  10. Re: Support Needed - Populating a 2d matrix with different binary number representations.

    Q:"Why a 2D array?"
    A:The matrix represents a possible board and therefore must be 2d.

    Q:"What problems are you having? Do you have the algorithm for generating the binary numbers?"
    I have an...
  11. Re: Support Needed - Populating a 2d matrix with different binary number representations.

    Q:"How would 01101 be stored in a 2D array?"
    A: This number is equal to 000001101 and would be presented by a 2d matrix NxN, where n=3, k=3:
    000
    001
    101



    Valid Example:
    For N=6, K=9,...
  12. Re: Support Needed - Populating a 2d matrix with different binary number representations.

    Q:"What code do you have so far?"
    A:I have a working function that when given a 2d matrix representing a binary number, will increment it to the next larger number with the same number of bits...
  13. Support Needed - Populating a 2d matrix with different binary number representations.

    Hello everyone,
    I am trying to write a function that does the following:
    When given int n and int k, it will:


    E.G.
    Given n=2 and k=1, the function will create a matrix for the following...
Results 1 to 13 of 14