formatting: extract outputs from a WHILE cycle in table format

Use `Table` instead of a `While` tie:

``````table = Table[{2, 3}^i, {i, 5}]
``````

{{2, 3}, {4, 9}, {8, 27}, {16, 81}, {32, 243}}

OR

``````table = Transpose[Table[i^Range[5], {i, 2, 3}]]
``````

{{2, 3}, {4, 9}, {8, 27}, {16, 81}, {32, 243}}

You can use `Grid` to show:

``````Grid[table, Dividers -> All]
``````

To update: If you have to use `While` you can `AppendTo` a list that is initialized in `{}`:

``````i = 1;
tab = {};
While[i < 6, AppendTo[tab, {2, 3}^i++]]
tab
``````

{{2, 3}, {4, 9}, {8, 27}, {16, 81}, {32, 243}}

Alternatively, you can use `Reap` / / `Sow` combination:

``````i = 1;
Reap[While[i < 6, Sow[ {2, 3}^i++]]][[2, 1]]
``````

{{2, 3}, {4, 9}, {8, 27}, {16, 81}, {32, 243}}

Algorithms – Practical calculation of disjoint vertex cycle covers of minimum weight

How are the vertex-disjoint cycle covers of minimum weight of large dense symmetric graphs in real implementations really calculated?

I know that the problem can be reduced to a general coincidence using the Tutte device or the device suggested by Lovasz and Plummer; However, there is a fly in the ointment with those reductions, namely that each vertex of the original graphic is replicated $$O (n)$$ times, producing a match problem for a chart with $$O (n ^ 2)$$ vertices and therefore a $$O (n ^ 6)$$ algorithmic solution

Question:

These are the devices actually used to calculate the lightest D factors and especially the 2 factors or, if the linear programming formulation provides significantly better performance, resp. footprint and, if so, which variant of linear programming is the most appropriate, primal, dual, primal-dual, etc.

I need an efficient way to generate those cylce covers to investigate the performance of a new idea for a heuristic TSH.

php – Cycle through CSV and keep image URLs

I am trying to go through a CSV with PHP, I have already done it, but now I need to keep the URLs of the images, since they are from a catalog of a distributor and thus be able to upload them to woocommerce.

The fact is that I can not find a way to find within an array, which I created to save all the CSV info, the image path, I used some PHP functions but without result. I enclose code and image of what I need.

1st CSV image and routes:

I have an HTML form that allows me to select the CSV to treat it and I'm interested in doing it in a generic way because this script can be used in more situations.

My current php script is like this:

`````` \$numero de campos en la línea \$fila: n";
\$fila++;
for (\$i=0; \$i < \$numero; \$i++) {
//echo \$datos(\$i) . "n";
\$array = \$datos(\$i);
echo 'contenido array: ' . \$array;
echo "";

//echo 'foto: ' . strstr(\$array(\$i), 'https://', true);
}

}

\$resultadoBusqueda = array_filter(\$array, function(\$var) use (\$buscar) { return stristr(\$var, \$buscar) } );
echo 'se ha encontrado el termino "' . \$buscar .'" en la posicion ';
echo \$resultados . "";
}
}else{
echo 'El termino "' . \$buscar . '" no se ha encontrado en el array ';
}

}
``````

But it returns me that an argument is missing. Anyway, I don't know if it will be the best way to do this. What I need is that, within the array, look for the string that begins with "http: //" and ends with ".jpg"

I appreciate all help.

a greeting

How to concatenate a string in an iteration cycle

My output is

one
one
two
one
two
3

The result I am looking for is
one
1 2
1 2 3
1 2 3 4
1 2 3 4 5

``````var x,y;
for(x=1; x <= 5; x++){
for (y=1; y <= x; y++) {
console.log(y)
}
}
``````

algorithms – Bellman ford – negative cycle

This is my code to detect a negative cycle in a graph using the Bellman Ford algorithm, but I cannot understand why it returns an incorrect answer.

``````public static final int INF = Integer.MAX_VALUE;
private static int negativeCycle(ArrayList() adj, ArrayList() cost) {
int dep() = new int(adj.length);
for(int i=0; i dep(j) + cost(j).get(v_index)) {
dep(v) = dep(j) + cost(j).get(v_index);

}
}
}
}

for (int j = 0; j < adj.length; j++) {
for (int v : adj(j)) {
int v_index = adj(j).indexOf(v);
if (dep(v) > dep(j) + cost(j).get(v_index)) {
return 1;
}
}
}

return 0;
}
``````

Way of the family to the reduction of the Hamiltonian cycle.

HAMILTON PATH: given a graphic directed $$G$$ Y $$2$$ The nodes begin and end, is there a hamilton route from beginning to end?

HAMILTON CYCLE: given a directed graph $$G$$ Y $$1$$ node start, is there a hamilton cycle that starts at the beginning?

Can Hamilton's path be reducible to the Hamilton cycle?

My reduction is to add another end of node & # 39; and let it have an edge from end to end & # 39 ;, and, finish & # 39; to begin.

Confused to show $$(G, start, end) in HAMILTON PATH Leftrightarrow (G, start) in HAMILTON CYCLE$$

The first part is easy.

Yes $$(G, start, end) in HAMILTON PATH$$, then there is a path to the random vertex r $${(s, r_1), (r_1, r_2), …, (r_n, end) }$$ and by the hamilton path algorithm $${(s, r_1), (r_1, r_2), …, (r_n, final), (final, final & # 39;), (final & # 39 ;, s) }$$. By definition $$(G, start) in HAMILTON CYCLE$$

Now the 2nd part

$$(G, start, end) notin HAMILTON PATH$$, … , so $$(G, start, end) notin HAMILTON CYCLE$$

I'm not sure how to explain the second part. I'm not sure if it's possible at this time.

stackoverflow – Why is integer overflow not a cycle?

Imagine that we have an 8-bit integer. Therefore, we can store integers from -128 to 127. Therefore, if we add 2, it will cause an overflow of the arithmetic operation & # 39; 127 + 2 & # 39; (in the type & # 39; Int8 & # 39;). Given that the bit to the left is sign-bit, the result should change sign-bit + remainder of the value and it should be -1 in Int8 (correct me if I'm wrong). But almost every time I try to hack the memory and add a value of sum overflow to a number, it will become a random number and I do not know why.

The question is why you do not go to the inverted number and what is that random number (where did it come from)?

np complete – Reduction of the simple hamilton cycle

HAMPATH

• Input: A non-directed graph G and 2 nodes s, t

• Question: Does G contain a Hamilton route from s to t?

HAMCYCLE

I want to show that HAMCYCLE is NP-hard

I'm going to show this by doing $$HAMPATH leq_p HAMCYCLE$$ since it is known that HAMPATH is NP-COMPLETE

The reduction is as follows

$$(G, s, t) a (G & # 39 ;, s & # 39;)$$

where $$s & # 39; = s$$ and to $$G & # 39;$$ I will add a border of $$t$$ to $$s & # 39;$$

This is polynomial time because we are adding only one advantage

Yes $$(G, s, t) in HAMPATH$$, then we know there is a hamilton path from s to t, our graph G & # 39; will be $$(s & # 39 ;, points, t)$$ but since we added a border of $$t$$ to $$s & # 39;$$ so

$$(s & # 39 ;, points, t, s & # 39;)$$, a cycle, asi $$(G & # 39 ;, s & # 39;) in HAMCYCLE$$

Now doing the opposite, if $$(G & # 39 ;, s & # 39;) in HAMCYCLE$$ then there is a hamilton cycle of $$(s & # 39 ;, …, s & # 39;)$$ which visits each node and returns to s & # 39 ;, which means that there is a node $$t$$ right before $$s$$ to make this a hamilton path, therefore $$(G, s, t) in HAMPATH$$

Up is all my intent. I was wondering if I could call $$t$$ in my reduction since it is not used as an entry in HAMCYCLE?

np complete – Verifying the solution of the Hamiltonian cycle in O (n ^ 2), n is the length of the G coding

In the CLRS textbook, & # 39; ch. 34.2 Polynomial time verification & # 39; says the following:

Suppose a friend tells you that a given
Graph G is Hamiltonian, and then offers to test it by giving the vertices in order along the Hamiltonian cycle. It would certainly be easy enough to verify the test: simply verify that the provided cycle is Hamiltonian by verifying if it is a permutation of the vertices of $$V$$ and if each of the consecutive edges throughout the cycle actually exists in the graph. I could certainly implement this verification algorithm to execute on $$O (n ^ 2)$$ time, where $$n$$ is the length of the coding
of $$G$$.

For me, for every consecutive pair. $$(u, v)$$ of the given cycle, we could verify if it is an advantage in $$G$$. In addition, we could use some color codes for each vertex to make sure we do not revisit a vertex. By doing so, we could verify if the given cycle is Hamiltonian in $$O (E) = O (m ^ 2)$$ time where $$m$$ is the number of vertices in $$G$$. In addition we can see the minimum coding. $$n$$ of $$G$$ is $$m ^ 2 = n$$. A) Yes $$O (E) = O (m ^ 2) = O (n)$$. Can anyone help me understand, why is it mentioned as $$O (n ^ 2)$$ instead!

Check your GoDaddy SSL billing cycle carefully

I have a ssl bought in Go Daddy since 2016, the first one I bought was the 10/27/2016

In the second year, they sent me an email to renew it on August 4, 2017, I told them it was due to expire in October.

third year, 06/09/2018 received SMS of the automatic renewal of the credit card, two months before

This year, today 07/12/2019 received SMS from the automatic renewal of the credit card, 3 months and 15 days before.

I discovered that my billing cycle has been reduced every year, since we know the billing cycle, when I paid annually for a service, the due date should be the same that was bought on the first day (October 27), but it became on September 11 after 3 years.

Please check your billing cycle carefully, your money is stolen every year.