instruction
stringlengths
0
29.8k
⌀
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}]}
null
https://cgi.luddy.indiana.edu/~sabry/cnf.html if you have a computationally-feasible program to solve SAT problems (NP-complete), but you don't know how to encode other problems into SAT, this website will encode factoring for you
Let's start with the equation you wrote in part 2: $\begin{aligned} E[T(n)] & =E\left[\sum_{q=1}^{n} X_q(T(q-1)+T(n-q)+\Theta(n))\right] \\ & =\sum_{q=1}^{n} E\left[X_q(T(q-1)+T(n-q)+\Theta(n))\right] \end{aligned}$ by linearity of the expectation. Now, since $X_q$ is independent from other random choices in t...
How many symmetric boolean functions exist that are linear? <br/> I got the number of symmetric functions as $2^{n+1}$ and the number of linear functions as $2^n$ but I'm not sure if the number of linear functions is correct. <br/> How do I combine both of these solutions? Is it simply $\frac{2^{n+1}}{2^n} = 2^n$?
Number of n-variable symmetric boolean functions that are linear
|combinatorics|boolean-algebra|
How many symmetric boolean functions exist that are linear? <br/> I got the number of symmetric functions as $2^{n+1}$ and the number of linear functions as $2^n$ but I'm not sure if the number of linear functions is correct. <br/> How do I combine both of these solutions? Is it simply $\frac{2^{n+1}}{2^n} = 2$?
I initially [brought this up on the Swift Forums](https://forums.swift.org/t/letting-the-compiler-figure-access-patterns-choose-the-data-structure-that-best-fits/69312), and it was suggested that this might be a thing better suited for CS SE. So here goes: I had this thought that the compiler already has enough info...
Could a compiler/static analysis infer the best abstract data type?
|data-structures|compilers|
Show how to check if n-bit number is divisible by 7 in logarithmic circuit depth. How can I construct the circuit to be able to check the divisibility?
Check if n-bit number is divisible by 7
|circuits|arithmetic|binary|
I recently got the following OS questions in my exam. **Q1) In the banker's algorithm, if the total number of resources in the system is 20 and the maximum resource allocation for a process is 5, what is the maximum number of processes that can be running simultaneously?** Options 1. 1 2. 4 3. 5 4. 20 ...
Bankers Algorithm - maximum number of processes and concurrency questions
|operating-systems|concurrency|synchronization|deadlocks|
null
So I have a bunch of strings that represent routes in a HTTP web framework. Each string has a leading `/`, some `/`-separated path segments which can either be a string, a single-segment wildcard `?`, or a trailing multi-segment wildcard `*`. (For this problem, we can assume that `*` can only be in a trailing position,...
Let's start with the equation you wrote in part 2: $\begin{aligned} E[T(n)] & =E\left[\sum_{q=1}^{n} X_q(T(q-1)+T(n-q)+\Theta(n))\right] \\ & =\sum_{q=1}^{n} E\left[X_q(T(q-1)+T(n-q)+\Theta(n))\right] \end{aligned}$ by linearity of the expectation. Now, since $X_q$ is independent from other random choices in t...
Is it possible for the hyperplane method for loop parallelization, to return more than one hyperplanes whose points are scheduled to be executed at the same time? In an example I studied (Shang & Fortes, 1991), I found nine hyperplanes, parallel each other and grouped in three sets, with the three hyperplanes of the fi...
Hyperplanes and loop parallelization
|parallel-computing|loops|
null
What is the complexity class of the following variant of the *SSP* problem: **Input**: set of integers $\{x_1,\ldots,x_n\}$, integer $k$ and integer $T$. **Output**: *Yes*, if there exists a subset $S\subseteq \{x_1,\ldots,x_n\}$ for which: $|S|= k$ and $\forall S'\subseteq \overline{S}$ it holds that: $\sum_{x_i...
Complexity of a variant of the Subset Sum Problem (second level polynomial hierarchy)
|complexity-theory|np-hard|complexity-classes|
Given CNF-SAT reduce it to the following decision problem: Given `n` items, `m` groups (and for each group a set of items) and a parameter `k`. The problem outputs yes/no if there exists `k` or less groups such that every item is at least in one of the selected groups. How can I reduce the CNF-SAT to this proble...
Reduce CNF-SAT to decision problem
|complexity-theory|reductions|satisfiability|decision-problem|
Given CNF-SAT reduce it to the following decision problem: Given `n` items, `m` groups (and for each group a set of items) and a parameter `k`. The problem outputs yes/no if there exists `k` or less groups such that every item is at least in one of the selected groups. How can I reduce the CNF-SAT to this proble...
By the winning instruction I mean a string that a deterministic polynomial time Turing machine can use in order to win the opponent in a competitive game. The difference from a certificate is that the winning instruction does not have to prove its own correctness, you just trust it. A naive winning instruction for T...
What would be the consequences of TQBF having polynomial length winning instructions?
|complexity-theory|
It is not clear in your solution why treating clauses as groups helps. Note that a satisfying assignment should induce a set of groups and vice versa. **Hint: a non direct reduction (but you can start from there)** Think about it as a covering problem. For example, it smells like the vertex-cover problem: each ...
null
I recently got the following OS questions in my exam. **Q1) In the banker's algorithm, if the total number of resources in the system is 20 and the maximum resource allocation for a process is 5, what is the maximum number of processes that can be running simultaneously?** Options 1. 1 2. 4 3. 5 4. 20 ...
$8^k \cdot x \mod 7 = x \mod 7$, therefore we can split the number into groups of three bits and add these groups. Now you use a 3-2 adder: A 3-2 adder takes three n-bit inputs and creates one n-bit output and one n-bit shifted output with the same sum: This is just done by connecting all triples of three bits with...
Let us consider the case where $p > 0$ exists and a string $|w| ≥ p$ can be divided into $uv^{i}xy^{i}z$ for each $i ≥ 0$. When we say that $|vy| > 0$ do we mean that at least one of the two must be greater than zero? or both? is it possible to demonstrate this condition with a practical example? Similarly wh...
Why in the pumping lemma of a context free grammar $|vy| > 0$ and $|vxy| ≤ p$?
|context-free|pumping-lemma|
{"Voters":[{"Id":755,"DisplayName":"D.W."}]}
null
NFA-universality (whether given NFA accespts all strings) is PSPACE-complete PSPACE = coPSPACE Can one construct NFA that is universal if and only if input NFA isn't?
How to construct complement of NFA universality?
|finite-automata|
By the winning instruction I mean a string that a deterministic polynomial time Turing machine can use in order to win the opponent in a competitive game. The difference from a certificate is that the winning instruction does not have to prove its own correctness, you just trust it. A naive winning instruction for T...
By the winning instruction I mean a string that a deterministic polynomial time Turing machine can use in order to win the opponent in a competitive game. The difference from a certificate is that the winning instruction does not have to prove its own correctness, you just trust it. A naive winning instruction for T...
I am a soon-to-be physics graduate student with a background in theoretical and experimental cosmology. In my work, I've often found myself applying machine learning models and techniques for the purposes of performing data analysis tasks. I, as many do, find the field to be fascinating, but have little more than a sup...
Resources for studying the mathematical foundations of machine learning, for someone from a math/physics background
|machine-learning|neural-networks|mathematical-foundations|books|
X86 does the actual move with one op code. A highly complex instruction that sets the source and destination address and the number of bytes would be unnecessary. Specifying registers with these three items is complicated enough. Now your comments indicate that you want an asynchronous instruction. If I want an asyn...
This test shows that you have at some point in time programmed a computer in a procedural language or at least seen someone doing it. A mathematician from the 1920s might very well fail this test. That doesn’t mean they would have any problem learning either computer science or software development.
{"OriginalQuestionIds":[401],"Voters":[{"Id":8532,"DisplayName":"Bruno"},{"Id":-1,"DisplayName":"Community","BindingReason":{"DuplicateApprovedByAsker":""}}]}
It is not clear in your solution why treating clauses as groups helps. Note that a satisfying assignment should induce a set of groups and vice versa. **Hint: a non direct reduction (but you can start from there):** Think about it as a covering problem. For example, it smells like the vertex-cover problem: each v...
null
Reading through https://en.wikipedia.org/wiki/Timeline_of_operating_systems to decide where to port some library software—network|crypto|archive abstracting—I'm writing in C (C89). DOS is definitely still in use today; and that takes us back to the 1980s. Perhaps [V6 UNIX (1975)][1]? - One of the early [BSDs][2]?...
Oldest Operating System still in use today?
|operating-systems|c|
Most likely TQBF, and even 2QBF, has no winning instruction. Let $f:\{0,1\}^* \to \{0,1\}^*$ be a [one-way permutation](https://en.wikipedia.org/wiki/One-way_function#Related_concepts) (OWP). Though we have no proof, it is believed/conjectured that OWPs exist. In particular, under reasonable cryptographic assumpti...
Most likely TQBF, and even 2QBF, has no winning instruction. Let $f:\{0,1\}^* \to \{0,1\}^*$ be a [one-way permutation](https://en.wikipedia.org/wiki/One-way_function#Related_concepts) (OWP). Though we have no proof, it is believed/conjectured that OWPs exist. In particular, under reasonable cryptographic assumpti...
If I understand your question correctly, you are asking whether the compiler can choose the implementation of a generic data structure, exactly how a programmer would define some variable to be a template in C++, and then specify how memory access and presence testing are carried out choosing the concrete implementatio...
The problem is too ill-defined to admit a definite answer. Can you construct some heuristics for a compiler to choose a data structure that might be suitable, with no guarantees? Sure, of course. Can a compiler guarantee to select the data structure that will provide optimal performance? No, that is undecidable...
I am a soon-to-be physics graduate student with a background in theoretical and experimental cosmology. In my work, I've often found myself applying machine learning models and techniques for the purposes of performing data analysis tasks. I, as many do, find the field to be fascinating, but have little more than a sup...
null
Your assumptions may be a little bit off. Deep learning is largely an engineering field, and it is a young and rapidly moving one. Most "why" questions don't have very good answers. To the extent that there are partial answers to the "why" questions, mostly they are found in research papers, and I'm not sure whether...
I am trying to find a way to automate solving for **all** possible numerical values in a large multivariable system of equations. By this I mean equations such as > k(90)*g(-3)=434 and >k(47)*g(-5)=237 Essentially I want to solve for variables such as g and k in the context of one another and all the equati...
Is there a way to automate solving for coefficients in multivariable systems of equations?
|algorithms|
I am trying to find a way to automate solving for **all** possible numerical values in a large multivariable system of equations. By this I mean equations such as > k(90)*g(-3)=434 and >k(47)*g(-5)=237 Essentially I want to solve for variables such as g and k in the context of one another and all the equati...
null
I am trying to find a way to automate solving for **all** possible numerical values in a large multivariable system of equations. By this I mean equations such as > k(90)*g(-3)=434 and >k(47)*g(-5)=237 Essentially I want to solve for variables such as g and k in the context of one another and all the equati...
How many symmetric boolean functions exist that are linear? <br/> Let $f$ be a $n$-variable boolean function. $f$ is said to be symmetric if it is unchanged by any permutation of its variables, i.e. for 2-variable boolean functions $f$ is symmetric if $f(a,b) = f(b,a)$. In addition $f$ is called a linear function if ...
I recently got the following question in my exam. **Q1) In the banker's algorithm, if the total number of resources in the system is 20 and the maximum resource allocation for a process is 5, what is the maximum number of processes that can be running simultaneously?** Options 1. 1 2. 4 3. 5 4. 20 Th...
Bankers Algorithm - maximum number of processes
I had the following question in an exam: Which of the following best describes the concept of concurrency in an operating system?** Options: 1. The ability to execute multiple programs simultaneously. 2. The ability to perform multiple I/O operations concurrently. 3. The ability to execute multiple threads ...
Concurrency in Operating System
|operating-systems|concurrency|
There are only 4 symmetric linear functions. You can easily show that you must have $c_1=c_2$ (otherwise $f(1,0,0,\dots,0)$ will be different from $f(0,1,0,\dots,0)$), and similarly, you must have $c_1=c_2=\cdots=c_n$. $c_0$ can be anything. Therefore, once you choose $c_0$ and $c_1$, the function is wholly determin...
If we take the equalities from your example: $$\begin{eqnarray*} 90k - 3g & = & 434 \\ 47k - 5g & = & 237 \end{eqnarray*}$$ Well, that's just a linear system, and can be solved by Gaussian elimination or other similar technique. If we look at the inequalities: $$\begin{eqnarray*} 47k - 5g & \le & 257 \\...
Strictly speaking, no. You could have an OS that can run one application at a time only. It would be much less useful, but possible.
The problem is NP-hard, when you have quadratic constraints. Solving over the reals: then your problem is an instance of quadratically constrained quadratic programming (QCQP), and you can find a single solution with a [QCQP solver](https://en.wikipedia.org/wiki/Quadratically_constrained_quadratic_program). Finding...
From the wikipedia of [Free variables and bound variables](https://en.wikipedia.org/wiki/Free_variables_and_bound_variables) > In computer programming, the term free variable refers to variables used in a function that are neither local variables nor parameters of that function. The term non-local variable is often ...
Free variable in the programming language
|functional-programming|variable-binding|
As you know, a [Turing reduction][1] from $L_1$ to $L_2$ (i.e. $L_1 \leq_T L_2$) means that if we can decide $L_2$, then we can also decide $L_1$. In general to show $L_1 \leq_T L_2$, we construct a machine $T$ such that $T$ decides $L_1$ and $T$ is permitted to query $L_2$. Being permitted to query $L_2$ means that $\...
I had the following question in an exam: Which of the following best describes the concept of concurrency in an operating system? Options: 1. The ability to execute multiple programs simultaneously. 2. The ability to perform multiple I/O operations concurrently. 3. The ability to execute multiple threads si...
null
Keep track of the and of a0 to a3, a4 to a7, a8 to a11 etc, a0 to a7, a8 to a15 etc, a0 to a15, a16 to a31 etc. This lets you calculate the and of any subarray in O(log n). Find the first a(I) >= k. Find the largest j such that the and of a(I) to a(j) is >= k. This may be optimal. If a(j) < k then look for the next ...
1. Fix $\langle M, w\rangle$, and consider the constructed machine $M_x$. It is not hard to see by the construction of $M_x$ that either $M_x$ accepts all its inputs (and that happens when $M$ halts on $w$), or $M_x$ does not halt on all its inputs (and that happens when $M$ does not halt on $w$). So $M_x$ behaves on a...
```.global foo foo: addi $t0,$zero,1 addi $v0,$zero,0 outer: beq $t0,$zero,exitout sll $t0,$t0,0 addi $t1,$zero,0 add $t2,$zero,$a0 addi $t0,$zero,0 inner: addi $t8,$a1,-1 slt $t9,$t1,$t8 beq $t9,$zero,outer sll $t0,$t0,0 addi $v0,$v0,1 lw $t8,0($t2) lw $t9,4($t2) slt $t7,$t9,$t8 beq $t7,$zero,skip s...
Calculate the CPI of a program
|algorithms|memory-management|memory-hardware|c|assembly|
```.global foo foo: addi $t0,$zero,1 addi $v0,$zero,0 outer: beq $t0,$zero,exitout sll $t0,$t0,0 addi $t1,$zero,0 add $t2,$zero,$a0 addi $t0,$zero,0 inner: addi $t8,$a1,-1 slt $t9,$t1,$t8 beq $t9,$zero,outer sll $t0,$t0,0 addi $v0,$v0,1 lw $t8,0($t2) lw $t9,4($t2) slt $t7,$t9,$t8 beq $t7,$zero,skip s...
1. Fix $\langle M, w\rangle$, and consider the constructed machine $M_x$. It is not hard to see by the construction of $M_x$ that either $M_x$ accepts all its inputs (and that happens when $M$ halts on $w$), or $M_x$ does not halt on all its inputs (and that happens when $M$ does not halt on $w$). So $M_x$ behaves on a...
```.global foo foo: addi $t0,$zero,1 addi $v0,$zero,0 outer: beq $t0,$zero,exitout sll $t0,$t0,0 addi $t1,$zero,0 add $t2,$zero,$a0 addi $t0,$zero,0 inner: addi $t8,$a1,-1 slt $t9,$t1,$t8 beq $t9,$zero,outer sll $t0,$t0,0 addi $v0,$v0,1 lw $t8,0($t2) lw $t9,4($t2) slt $t7,$t9,$t8 beq $t7,$zero,skip s...
null
> Can we say only global variables are the free variables? No. [Counterexample in ECMAScript](https://jsfiddle.net/jwmittag/6wgr8ydq/1/): ```lang-ecmascript function outerFn() { const outerVar = "Outer"; function innerFn() { return outerVar; } // Could also be written: const innerFn2 =...
Exercise 14.1 of Elements of Information Theory asks us to prove that there is a constant c such that $$K(x,y)\leq K(x) +K(y)+c$$ for all binary strings $x,y$. Intuitively this seems true. Just write a program that first runs the program that $p_x$ that outputs $x$. Then the program $p_y$ that outputs $y$. Final...
Kolmogorov complexity of tuples