algorithms – Maximum-internal out-branching – Computer Science Stack Exchange

Thanks for contributing an answer to Computer Science Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

Top-level tuples/attributes enquiry – Computer Science Stack Exchange

Thanks for contributing an answer to Computer Science Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

c++ – what exactly is the science behind mappers and the ppu of the NES?

I’m a wizard when it comes to emulation of the 6502 processor ( i literally read the entire hardware manual).

But despite reading the NES wikia and and a bit of mappers there just doesn’t seem to be a comprehensive way to study the underlyings of the ppu and mappers .

I don’t need every specific there is about these 2 subjects. But just an abstracted idea(ideally explained in detail without covering everything that is already on the wikia).

thanks in advance

Walks on Directed graphs – Computer Science Stack Exchange

Let G = (V,E) be a directed graph, where V is a finite set of nodes, and E ⊆ V × V be the set of (directed) edges (arcs). In particular, we identify a node as the initial node, and a node as the final node. Let x and B be two non-negative integer variables. Further, we decorate each edge with one of the following four instructions:

x := x + 1;

x := x − 1;

x == 0?;

x == B?;

The result is called a decorated graph (we still use G to denote it). The semantics of a decorated graph is straightforward. It executes from the initial node with some non-negative values of B and x (satisfying 0 ≤ x ≤ B), then walks along the graph. G can walk an edge (v,v0) if all of the following conditions are satisfied:

• if the edge is decorated with instruction x := x+1, the new value of x must satisfy 0 ≤ x ≤ B.

• if the edge is decorated with instruction x := x−1, the new value of x must satisfy 0 ≤ x ≤ B.

• if the edge is decorated with instruction x == 0?, the value of x must be 0.

• if the edge is decorated with instruction x == B?, the value of x must equal the value of B.

If at a node, G has more than one edge that can be walked, then G non deterministically chooses one. If at a node G has no edge that can be walked, then G crashes (i.e., do not walk any further). It is noticed that B can not be changed during any walk. However, its initial value can be any non-negative integer. We say that a decorated graph G is terminating if there are nonnegative initial values for B and x (satisfying 0 ≤ x ≤ B) such that G can walk from an initial node to a final node. Design an algorithm that answers (yes/no) whether G is terminating or not.

algorithms – Complexity function – Computer Science Stack Exchange

we start with i = 1, j = 1, i <= n, and j <= i and they increment i = i++ and j = j ∗ 2 respectively. The output prints ‘k’ times, whichreprents inner loop.
output: print s k times. Example when n=5, loop will print 11 times. How to find the complexity function of this algorithm for n=5?

So far, I figured out the pattern for n=5, p= 1+(2+2)+(3+3) which can be generalized by k2^(k-1) for n size 1+(2+2)+(3+3+3+3)+….. .
The answer is ((n+1)log(n+1)+1)-(2^(logn+1)) by the summation k
2^(k-1)- constant when k=1 to p . How do i go from summation to this answer? What value should be P if i do summation from k=1 to P:1+(2+2)+(3+3)?

data science – abrir url no python

como abrir um livro no python direto pela web, encontrei esse código na pagina da Microsoft onde ele lê a pagina com o comando read_url, mas não consigo abrir com esse comendo, tentei usar o requests mas também não consegui me volta um erro, esse foi o codigo que esta na microsfot.

huck_finn_url = ‘http://www.gutenberg.org/files/76/76-0.txt’
huck_finn_text = read_url(huck_finn_url)
huck_finn_chapters = huck_finn_text.split(‘CHAPTER ‘)(44:)

Proof of algorithm correctness – Computer Science Stack Exchange

I am studying about algorithm correctness and have enctountered this problem.

function add(y,z)
comment Return y + z, where y,z are natural numbers
x :=0; c:=0; d:=1;
while(y>0)v(z>0)v(c>0) do
    a := y mod 2;
    b := z mod 2;
    if a XOR b XOR c then x := x+d;
    c:= (a AND b) v (b AND c) v (a AND c);
    d :=2d; y:= floor(y/2);
    z := floor(z/2);

The book that I’m reading says that loop invariant is $(y_j + z_j + c_j)d_j + x_j = y_0 + z_0$ and I honestly can’t understand the conclusion. How do you come up with this? Why is this true?

pruning branch and bound – Computer Science Stack Exchange

Thanks for contributing an answer to Computer Science Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

computer science – Is sequential consistency equivalent to performing memory accesses by a processes in program order and performing each memory access atomically?

In Fundamentals of Parallel Multicore Architecture, by Yan Solihin, p304 defines sequential consistency memory model:

Overall, we can express programmers’ implicit expectation of memory
access ordering as: memory accesses coming out of a processor should
be performed in program order
, and each of them should be performed
atomically
. Such an expectation was formally defined as the sequential
consistency (SC) model. The following is Lamport (37)’s definition of
sequential consistency
:

A multiprocessor is sequentially consistent if the result of any
execution is the same as if the operations of all the processors were
executed in some sequential order, and the operations of each
individual processor occur in this sequence in the order specifed by
its program.

where the atomicity of memory accesses is defined on p303 as

an expectation that each memory access occurs in an instant, without being overlapped
with other memory accesses
. In the example, the expectation assumes that when process P0 writes to shared variable x, the write is instantly propagated to both processes P1 and P2.

I was wondering if sequential consistency is equivalent to the combination of

  • “memory accesses coming out of a processor should be performed in program order”, and
  • “each of them should be performed atomically”?

I guess yes because “each of them should be performed atomically” is required by SC and its “instant write propagation” seems to guarantee “the result of any execution is the same as if the operations of all the processors were executed in some sequential order”.
But I can’t prove or disprove my suspision.

Thanks.