Note that there are some explanatory texts on larger screens.

plurals
  1. POMultithreading brute-force and recursive multidimensional loops. Another way?
    primarykey
    data
    text
    <p>I like figuring things out myself in terms of programming... So I was thinking of a method to loop through multi-dimensional arrays with dynamic dimensions. (mainly for things like brute force)</p> <p>The method I came up with to loop through arrays of unknown dimensions is as follows:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; /* a simple example of the method I'm using */ void func(int *v,char *usable,int len,int D,int d) { for(v[d] = 0; v[d] &lt; len; v[d]++) { if(d+1 &lt; D) func(v,len,D,d+1); else { for(int i = 0; i &lt; D; i++) printf("%c",usable[v[i]]); printf("\r"); } } } int main() { int *v,z,min = 4,max = 6; for(z = min; z &lt;= max; z++) { v = malloc(sizeof(int)*z); func(v,"0123456789",10,z,0); printf("\n"); free(v); } return 0; } </code></pre> <p>I see this as a nice elegant solution but I've come up with more problems when thinking of multi-threading the process. I would like to know <strong>alternate solutions</strong> for this type of process that I haven't discovered, as well as <strong>possible ways of multi-threading</strong> a process like this. One method I tried was creating pre-determined <em>chunks</em> but because of the large amount of values that need to be processed when digits or usable characters increase are too big, they overflow any normal variables.</p> <p>One might ask: "Why do you need to create a multithreading brute force." And I would reply that the ability to create a multithreaded brute force means the ability to multithread other processes like maze-solving and best-route determination.</p> <p>Thank you in advanced.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload