Creating an array of bitArray

Hi, I want to create an array of BitArray(i.e. BitArray[]) and with each BitArray having a size of n. Is it possible Thanks

Currently I'm using this.

            BitArray[] a = new BitArray[numVar];
            for (int i = 0; i < numVar; i++) {
                a[ i ] = new BitArray(numProc);
            }

Would there be a better way



Answer this question

Creating an array of bitArray

  • Postman001

    I meant can I skip the iterative step

  • captainsina

    Not really. What's wrong with the way you're doing it now



  • kalprin

    what if numVar is >1000 I will have to iterate 1000 times to set the size of each BitArray. In this manner, my complexity will be O(n)

  • CarlaC

    No



  • Henny

    Right, creating objects is always a O(n) operation. Is that a problem



  • Creating an array of bitArray