instruction stringlengths 35 29.1k |
|---|
What would be the problem of running the following scala codes assuming we are working with dynamic scoping and a global stack to store environments as some variants of Lisp do?
def fact(n:Int,f:() => Int):Int =
if(n == 0) f()
else fact(n-1,() => n*f())
fact(7,() => 1)
def incrementer(x:Int) = y => y+x
increment... |
I am developing an application, which performs combinatorial function as described below. Could anyone point out a suitable algorithm (or direction)?
== Basic scheme: ==
There are fixed amount of slots (say air tickets), a few hundreds of workers, and a few dozens of jobs. Every time, a bunch of workers (the "crew") ar... |
In Thomas Sudkamp's book, Machine and Languages, there is a depth-first top-down parsing algorithm (please see the algorithm here).
My main question is:
1) Is this algorithm a (backtracking) recursive descent top-down parsing?
This is because I am confused with the difference between the terms depth-first top-down pa... |
A sequence of positive integers $a_1, ..., a_n$ is given. Compute the
length of the largest continuous subsequence such that the number of
even integers is equal to the number of odd integers in the subsequence.
I have thought that we could take all those integers mod 2 and store those in an array, then take two ... |
Intuition suggests that SAT is definitely not sparse. For any well-formed SAT problem $\phi$, we have $(\phi \in SAT) \vee (\neg\phi \in SAT)$, and $\exists \phi : (\phi \in SAT) \wedge (\neg\phi \in SAT)$ (perhaps "many" such $\phi$ satisfy this).
The set of well-formed queries is not sparse, consider $a_1 \wedge \cdo... |
Consider the decision problem Bip[3–1], define as follows:
Instance: $G = (S,T;E)$, bipartite graph, with $d_G(s) = 3$ for all $s \in S$.
Question: Does there exist $S' ⊆ S$ such that in $H = [S'∪T]_G$ we have $d_H(t) = 1$ for all $t \in T$?
I should prove that 3SAT reduces to Bip[3-1].
I understand what the problem... |
My question is, is comparison based sorting problem, in time complexity, a superlinear problem or a sublinear problem?
In more details: we know that sorting using comparison have the achievable lower bound of $O(n\ln n)$ where $n$ is the number of items to be sorted. Now the question of superlinear and sublinear is dep... |
We all the time write and talk about mathematical problems in plain English. For example, we define "the traveling salesman problem". But what is the actual, underlying structure of a "mathematical problem"? Can arbitrary mathematical problems be expressed exactly, in a formal language? Is it meaningful to talk about a... |
The language in question is $L = \{M : M \text{ is a Turing machine that halts in } 100n^2 + 200 \text{ time}\}$.
Attempt 1
Suppose $L$ is decidable. Let $M_1, M_2, \ldots$ be the Turing machines in $L$. Now construct a new Turing machine $M$ that works as follows:
on input of length $n$ run $M_n$ and output the oppos... |
Let $A$ be a randomly generated matrix. Let $I$ be the identity matrix. $\times$ is the matrix multiplication operation, $/$ is matrix division (multiplying the first matrix by the inverse of the second).
$$
I \times A \times A = B
$$
Provide $B$ and $I$ to the recipient. To create encrypted message $E$ from unencrypte... |
I am looking for a data structure to represent non-orientable manifolds (i.e. meshes like Moebius Strip, but without self-intersection). I will then implement other algorithms using this DS such as, but not limited to, Catmull-Clark Subdivision, Offsetting, Minkowski Addition and Minimal Surface. I know that I cannot u... |
I have a constraint $X \ge Y$ in a Linear programming formulation, where both $X$ and $Y$ are binary. I want to check this constraint on a condition like:
if (Y==1)
then check the constraint
else
Don't care about the constraint
How to do it.
|
Given a universal set of elements $\mathbf{U} = \{a_1, a_2, .., a_n\}$, a set $\mathbf{R} = \{a_i\} \subset \mathbf{U}$ where $i ϵ \{1, .., n\}$, a set $\mathbf{P} = \{R_1, .., R_m\}$ and a set $\mathbf{C} = \{P_1, P_2, .., P_l\}$, how do I go about finding a set $\mathbf{S} = \{a_1, .., a_n\} \subset \mathbf{U}$ such ... |
I want to show that for every deterministic pushdown automaton with the language of the empty stack there is a deterministic pushdown automaton that always halts.
my transition function of $P$ is
$\delta: \Gamma \times Q \times \Sigma_\lambda \to \Gamma^* \times Q$
I tried to use look ahead pushdown method. I think I s... |
My understanding of the halting problem in layman's terms is that there is no algorithm which will accept an arbitrary program as input and return true if it halts and false if it does not.
For a Turing machine does the question, "Does this Turing machine halt for all inputs?" always have an answer in the first place?
... |
In a graph, an edge dominating set is a subset D of the edges such that any edge in the graph is either in D, or shares an endpoint with an edge in D.
The Minimum Edge Dominating Set problem is to find an edge dominating set
of minimum cardinality. The decision version of this problem is known to be NP-complete, but I ... |
I was referring to slide 4 of this, which states following:
It is decidable whether a given CFG accepts a non-empty language?
Then I was reading Intro to Automata theory book by Ullman et al. It states following:
Let $L_{ne}$ be the language of all codes for Turing machines that accept atleast one input string.
$... |
The automaton has to recognize the language $(a^n)(b^m)$ so the number of $b$s is at least the number of $a$s and at most twice that number.
The only thing I have achieved is to get an automaton that recognizes
$(a^n)(b^n)$ but that's only part of what I need.
Thanks a lot for your help.
|
I am trying to learn the binary number system but I keep coming up against a barrier to my comprehension. To people who are in the know this will no doubt seem an extremely elementary error so please be kind :). The problem concerns the eighth count. I’m going to explain my reasoning up to that point alongside the cou... |
In traditional bloom filters, each item is hashed some fixed number of locations. One variant of this is to hash items a varying number of locations within the same bloom filter.
This idea is presented in Zhong et al., Optimizing data popularity conscious bloom filters, PODC '08 and Bruck et al., Weighted Bloom filter,... |
I'm currently writing some code to generate binary data. I specifically need to generate 64-bit numbers with a given number of set bits; more precisely, the procedure should take some $0 < n < 64$ and return a pseudo-random 64-bit number with exactly $n$ bits set to $1$, and the rest set to 0.
My current approach invol... |
Design a pushdown automaton that can accept
$$\{w|w\in\{a,b\}^*\text{ and $w$ has twice as many $a$s as $b$s}\} \, .$$
I have a solution as the following. The notation seems to follow "An Introduction to Formal Languages and Automaton" by Peter Linz, where $\delta$ is the transition function with three arguments: cu... |
We have that MIMA (Neumann MInimal MAchine) has the following commands:
I want to implement the Mima-command EQL adr (equal?) with the other Mima-commands.
We have that for that command it holds the following: $$\text{Accu} \leftarrow \left\{\begin{matrix}
-1 , &\text{ Accu }=M(adr)\\
0 , &\text{otherwise}
\end{m... |
In a related post: Algorithm for solving binary quadratic Diophantine equations (BQDE) and its CTC there was a conclusion that with regard to general binary quadratic diophantine equation (with all non-zero coefficients), the solutions (if existent) can be found in exponential time.
However, is this also the case for ... |
Candy Allocation Problem: Suppose there are $n$ candies, each with a weight $w_i$ gram. There are $m$ kids, and each kid needs to eat at least $\omega$ grams of candies to be full. Candies cannot be cut into pieces. Is there a candy allocation algorithm such that at least $k$ kids can be full?
Is the above problem NP-c... |
How can machine learning help extract a Boolean relationship in a given binary input-output data set?
Let us assume that the given data set is exhaustive - ie. it cover all possible input combinations, can we derive the boolean relationship between inputs and outputs? (Say we assume x inputs and 1 output)
Further, if t... |
In Sipser's text, when proving that there exists an oracle $A$ such that $P^A \ne NP^A$, he writes:
Let $M_1, M_2, \ldots$ be a list of all polynomial time oracle TMs.
I understand that there are countably many Turing machines, but aren't there uncountably many oracles?
|
I'm working on trying to make an "entropy pool" that will be fed as input into an RNG (as in, ex, Fortuna). In order to do so, I need to take various collected data and extract as much entropy as possible to turn it into unpredictable bits. I've read many papers about extracting randomness, but I haven't understood how... |
I read in this assembly programming tutorial that 8 bits are used for data while 1 bit is for parity, which is then used for detecting parity error (caused by hardware fault or electrical disturbance).
Is this true?
|
I have an implementation of a data structure I have to study for a group project (Fibonacci heaps if you're interested).
I'm asked to compare the theoretical results of the operations in amortized time, with the running times of my implementation.
Now my question: since amortized times are based on the fact that we loo... |
Let $L = \{\langle M \rangle \mid \text{M is a TM which accepts only the string "010"}\}$. Prove that $L$ is undecidable.
This is my solution, reducing $A_{TM}$ to $L$:
$R(\langle M,w \rangle)$ outputs $M'(x)$, such that:
if $(x == "010")$: run $M$ on $w$ and do on $x$ what $M$ does on $w$
else reject $x$
The langua... |
While doing the current assignment for my formal languages and automata course, I kind of got stuck on exercises involving unary languages (I hope that's the right term), i.e., languages which build upon a single letter. I don't want to ask about the specific exercises, though, but rather about a much more general conj... |
Regarding the last step of the proof of the lower bound of comparison based sorting, there is the following implication for the runtime T in my book:
$T \ge n \log_2 n - n \log_2 e \implies T \in \Omega(n \log_2 n)$
I tried to verify this by proof, is my conclusion correct?
For any real value $x, a$ element of the exte... |
I have to use only bitwise operators to compare two numbers (represented in two's complement), and return $-1$ (represented by all $1$'s) if the numbers aren't equal or return $0$ (represented by all $0$'s) otherwise.
Say $a$ and $b$ are $W$ bits long ($W$ is not necessarily $2^n$). I find it easy to find out if both n... |
According to this source, Chaitin's constant $\Omega$ is normal.
Each halting probability is a normal and transcendental real number that is not computable, which means that there is no algorithm to compute its digits. Indeed, each halting probability is Martin-Löf random, meaning there is not even any algorithm which... |
I'm looking for a formal definition of file that does not only include storage but also abstractions like procfs or /dev/null (or any fuse-based file) that do not relate to storage.
So far I know that all files are abstractions that
can be identified
can have names (usually organized in hierarchical structures)
can be... |
In DFA/NFA the automaton halts when it finishes reading the string.
In a PDA there's the string and the stack. When the string is finished and there are symbols on the stack does it ignore them? Or does it have to pop them?
Or maybe does the behavior depend on whether the PDA is deterministic or not?
Here's an example... |
I have an even number of points, each with coordinates $(x, y, z)$. I need to group these points into pairs. The cost of pairing two points is the Euclidean distance between them. I'd like to find the optimal pairing such that the total cost is minimized. What would be a good way/algorithm to solve this?
For example, i... |
We have that MIMA (Neumann MInimal MAchine) has the following commands:
I want to write a MIMA program that takes the value $2^{23}-24=8.388.584$ to the memory cell $y$.
We have to take attention at the number of the bits, that we need for the representation of the number in two's complement.
I have done the foll... |
Self-organizing maps undergo unsupervised training to produce a low-dimensional, discrete representation of the input space. Why is this useful?
I think the results of the self-organizing map would have to be combined with some other machine learning algorithm or neural net in order to solve problems. Is this the case?... |
Suppose we have a set of equations like this
p7=f(p1+p6); p6=f(p2+p5); p5=f(p3+p4); p4=f(p3); p3=f(p2); p2=f(p1); p1=f()
It can be represented by computational graph below
If each intermediate value takes 1 unit of memory, you need at least 4 units to compute p7 without any duplicate computation.
Is there an algorit... |
Suppose I have a regular rectangular weighted grid with multiple agents and obstacles. Agents cannot be in grid sites that contain obstacles, and for simplicity assume multiple agents can be in the same grid site.
If I select a single location on the grid and want to find the nearest agent to that location, a good solu... |
I am trying to learn the Rice–Shapiro theorem on my own. Here is the theorem:
Let $Γ$ be a set of computable functions such that the set $R_Γ$ is recursively enumerable. We have $f ∈ Γ$ if and only if there exists a finite function $θ ∈ Γ$ such that $θ ⊆ f$.
I will appreciate if anybody helps me to make the theorem c... |
I was wondering whether I can solve the following problem by using a greedy strategy: Let's say that I have a set of containers with 2 dimensions (width and height) and a set of items also with 2 dimensions. Can a solution be found where each item is assigned to a container so that it fits inside? I can have containers... |
I trained an XGBoost model that classifies 50 different classes, therefore it generates a lot of boosters (trees). Also, I wrote a script that turns trained model to C++ code and it works really fast because every tree is simply nested if-else statement. What I noticed is that many trees are similar and I was wondering... |
I am wondering if a constrained insert-only form of Levenshtein distance has been implemented before by someone? In my particular use case, all other operations should not count as they are not possible. Only parts of the strings can be stripped off. As an example, if our library has "Hello" and "complex".
These string... |
I am trying to understand the difference between these two but it looks like as if they are calculated the same way. What is the difference?
R precision:
R precision is the precision at the Rth position in the ranking of results for a query that has R relevant documents.
Precision at K:
Precision at K is calculate f... |
Does anyone have any ideas on a seating chart optimization formula for a call center environment? There are "docks" in which the workers sit. Each dock has approximately 15 seats, some more some less. The workers are on teams and work the same schedule and sit in their dock together. The problem is there are more teams... |
I'll try to formulate my problem through an example.
Lets suppose we have a collection of items of type a,b,c,d,e,f.
a1, a5, a7
b2, b3
c5, c6, c7, c8
d4, d5
e1, e2, e3
f3, f7, f8
If we take one element from each type there are 3*2*4*2*3*3 abcdef lines (combinations).
We have another random line
a1b5c7d1e5f7.
I want to... |
In linear programming, if we model the solution as a polytope, every vertex is a solution.
I'm trying to prove the following statement:
If $x$ and $y$ are two solutions with $n-1$ joint constraints, there exists a solution vector $c$ such that, for each $v\in P$ (the polytope of the problem) that is different from $x$... |
What is the minimum number of comparisons required to determine if an integer appears more than $n/2$ times in a sorted array of $n$ integers?
I am trying binary search on the array A.
Algorithm(A):
x = A[mid], where mid is the middle element of the array.
Compare x with A[n/4] and A[3n/4].
If x = A[n/4] and x ≠ A[... |
Given a 2D lattice with coordinates $1 \leq x \leq c$ and $1 \leq y \leq d$, we define $f(x, y) = xy$.
We wish to find a boolean function $I(x,y)$ that determines in $O(1)$ time whether or not $(x,y)$ belongs to the set of points $S$ of size $k$ such that the sum $Z(S) = \sum_{(x,y) \in S} f(x,y)$ is smaller or equal ... |
We have two circular sequences, which means there is no start or end in the sequences, how to test if two sequence are equal or not in linear time? I have two circular sequences of E. Coli bacteria with length (4,639,221). I thought about attaching two sample of the first sequence and find the other one in it in linear... |
I am trying to understand how a simple image recognition of an image with dynamic size could work. What I have seen is that parts of the images are taken and evaluated. For example a simple finger recognition could be done turning the image grayscale, taking parts of the image and evaluating them. What I understand is ... |
Given DTIME($n^2$) contains NTIME($n^{100}$) show that P=NP.
I think it's supposed to be straightforward but I just can't see it.
Take $L$, a language in NP. $L$ has a Turing machine which runs in NTIME$(f(n))$. If $f(n)$ is $\Omega(n^{100})$ it's obvious, but what about $O(n^{100})$?
|
I am trying to find the name of this feature that is implemented with SQL Databases:
Given a Record $R^1$ in table having two values for two different fields, e.g.
Let value of field 1 $F_1$ be $V_1$, Let value of field 2 $F_2$ be $V_2$
A any query requiring records s.t. $F_1 = V_1$ should contain $R^1$.
Also any quer... |
Can True Randomness be achieved by composing prngs in different states and with different algorithmsv(e.g. have $n$ different composition algorithms, use a prng to select any permutation of them. A lot $(\sum_{i=1}^{n}{^nP_i})$ of permutations exist. Compose the algorithms selected using the permutation. Whenever a new... |
In generating reports, sometimes there is a need to produce quite involved phrases in one of natural languages given numerical or boolean parameters.
To get a feel of it, it is enough to take a look at convert integers into words or time ago algorithms.
These solutions use (procedural/OO/functional) programming and Tur... |
As you know in computation theory, there is a simple programming language equivalent in power to Turing machines. It is described as follows:
Values: natural numbers only, but of unlimited precision.
• Variables:
– Input variables X1, X2, X3, . . .
– An output variable Y
-Local variables Z1, Z2, Z3, . . .
• Instruct... |
Reading Crystal Programming Language They says it is inspired from many programming language and Go.
I would like too know which part of Golang, since it is not its syntax.
|
Given an unknown $x$ and an oracle $O(r)$ such that:
If $O(r)$ is true then $x \geq r$.
If $O(r)$ is false then $x < 2r$.
Conversely, the oracle has a defined behaviour only outside the interval $(x/2, x]$, and may output anything between.
We want to find a factor 2 approximation of $x$.
What is the strategy with a m... |
I wanted to Solve the following Recurrence Equation using Master Theorem and Back substitution but Im stuck at certain point . can u pls help me how to proceed further
$T(n)=T(\sqrt{n})+n+c$
Using Master Theorem,
put n = $2^{m}$
$ T(n)=T(2^{m})= S(m)$ ie $T(\sqrt{n}) = S(\frac{m}{2})$
Hence the Recurrence Relation will... |
int IsPrime(n)
{
int i, n;
for (i=2; i<=sqrt(n);i++)
if(n%i == 0)
{printf("Not Prime \n"); return 0;}
return 1;
}
Here the loop executes for $ \Theta (\sqrt{n}) $ time . But my teacher said that it is not because the lower bound is $ \omega (1) $ I was not able to understand why it so ... |
I'm preparing for CS201 exam and I stumbled upon an interesting problem.
Input:
A sequence of random positive and negative integers (up to 1.0000).
Output:
A contiguous (to be clear: subsequence of consecutive elements) subsequence of the original sequence, such that after its reversal in the original sequence the bal... |
This variant is almost similar to the normal nim game which states -
Two players take turns to remove one or more items from a single, non-empty pile. The player who removes the last item from the last non-empty pile is declared as a winner.
The twist is an inclusion of a "pass" move for each non-empty pile. To make... |
Large scale optimization (for example using AMPL) can be used to solve equilibrium systems which have components with fixed mathematical relationships. What is the difference between this and using an equation-based simulation system (like Modelica) to solve an equation-based system?
Of course, most simulations have a ... |
I am doing a project on task assignment with geographic constraints which naturally leads to the following question.
Let $\mathbb{N}$ denote the set of integers. Given a finite subset $A \subset \mathbb{N}$ and a function $T: A \rightarrow \mathbb{N}$, let $R(T)$ denote the range of $T$ and define $${\rm cost}_r(T)= \... |
I was reading this paper by Shamos, M.I, on "Geometric Intersection Problems" (http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.366.9983&rep=rep1&type=pdf) , and was trying to understand it's Theorem 6, which says " Whether any two of N convex k-gons intersect can be determined in O(N(k+log N log k)) time."
... |
I'm not exactly sure whether this question belongs to this SE or not, but it doesn't seem to fit elsewhere.
Say a process behaves in a deterministic fashion (that is, it gives the same output when an input is entered over and over again), then can we build it as an algorithm?; if not, can you think of a counter-example... |
Every time I ask why most people think that P ≠ NP, I get a response like "because theorem proving is harder than proof checking".
From this, I understand that proving theorems is hard. But why is this? In fact, it is known that a theorem, in mathematics, is a statement that has been proved on the basis of previously ... |
Given the following pseudocode for function AP(x, y: integer) which returns an integer,
function AP(x,y: integer):
if x = 0 then return y+1
else
if y = 0 then return AP(x-1,1)
else return AP(x-1, AP(x,y-1))
I need to prove, $\forall x (AP(x, y) > y)$.
I have tried solving it using mathemati... |
We have the following function which determines the Nth fibonacci number:
int fib(int n){
if(n<=0) return 0;
else if (n==1) return 1;
return fib(n-1)+ fib(n-2)
}
Find the time complexity
I am currently reading the book "Cracking the coding interview" and the answer it gave is quite disappointing. The b... |
Here is the "naive" implementation of Dijkstra's algorithm that the professor uses:
For a directed graph $G = (V,E)$ as input
Initialize:
$X = \{s\}$ (the vertices processed so far)
$A[s] = 0$ (computed shortest path distance)
$B[s] = empty path$ (computed shortest path)
Main Loop:
While $X \neq V$:
Among a... |
I am wondering if there is a log time WBT (weight balanced binary search tree) data structure in which for any node, the sizes of its left and right subtrees diff at most by 1.
PS: I have read through Balancing weight-balanced trees but the weights of subtrees can differ up to a factor of $\Delta$.
|
I came across a bridge crossing problem. It got me wondering: Can it be reduced to some sort of scheduling problem. If not, is there any other general problem it can be reduced to?
Here is the problem:
John, Paul, George and Ringo are standing at one end of a bridge crossing. All four must get to the other side. Each ... |
The naive prime test goes something like this:
is_prime(n):
for(i=2; i<=sqrt(n); ++i):
if n mod i == 0 :
return false
return true
If $n$ is prime the loop runs for $\sqrt(n)$ iterations. I was wondering what the "average" runtime is. It is of course troublesome to define this properly, because there is... |
Could anyone tell me If I can prove regularity of given language using pumping lemma like I did below? If my prove is wrong could anyone tell me how to prove that the language is not regular using pumping lemma?
$$
L = \left\{ a^{n}b^{i}c^{n}\in L \mid (m,n,i >=0)\ and\ ((m +n)\%3 = 0 ) \ and\ ( m + n >= i ) \right\}
$... |
I have two datasets $A$ and $B$:
$A = \{1, 5, -34, 34.34323, -23.5444, 9.43, ....\}$
$B = \{-0.5, 44, -0.243, -3455, 2.22221, -23.23, ....\}$
Those datasets contain a big amount of "random" numbers (They are actually not random, but their source does not matter for this question). Both datasets always have the same siz... |
There is an integer array that contain $n$ numbers, in the array there are $k$ distinct elements up to $k = 50$.
Is it possible to sort this array in linear time, by using only comparisons?
I know that comparison sorts cannot perform better than $\mathcal O(n\log n)$, so maybe I have to show a sort function that sort t... |
My favourite algorithm textbook: The Algorithm Design Manual S. Skiena.pdf
had this interesting problem:
1-28. [5] Write a function to perform integer division without using either the / or * operators. Find a fast way to do it.
What's the lower bound for asymptotic complexity of this problem? `
P.S: I know repeate... |
I have been trying to find a solution both theoretical and practical to my problem but I just can't. The question is you have x players that should play some rounds y of games in groups of 4. Now if a player was in a game with somebody else, he is not allowed to be ever again with that player in the same group. Now the... |
Short version: common MT (and MT64) implementations have a tempering parameter 'd' (a bit mask). The papers I've looked at describing MT don't include it. Where is it from? When was it added?
Long version! :)
I'm looking at using a family of MT's with different parameters (for reasons). Nishimura published this paper d... |
In order to tackle this problem I first observed that
$$\phi(p_1^{e_1} \space p_2^{e_2} \cdots \space p_k^{e_k}) = (e_1 + 1)(e_2 + 1)\cdots(e_k +1)$$
Where $\phi(m)$ is the number of (not necessarily prime) divisors of $m$. If $m$ is the smallest integer such that $\phi(m) = n$, then
$$\phi(m) = n$$
$$(e_1 + 1)(e_2 + 1... |
I need to prove that
$\forall a>0.BPP[{a,a+\frac{1}{n}}]=BPP$
$BPP[a,b]$ definition:
A language L is in BPP(a,b) if and only if there exists a
probabilistic Turing machine M, such that
M runs for polynomial time on all inputs For all x in L, M
outputs 1 with probability greater than or equal to b For all x
not i... |
For a given regular is expression, once we construct a deterministic finite automaton: is that automaton unique for that expression? In a sense, that no other DFA (different number of vertices or transitions) can be constructed from that same regular expression.
|
Consider the following problem:
Is $L_1 * L_2$ is of $LType$?
where we know that both $L_1$ and $L_2$ are of type $LType$ and $LType$ is closed under $*$ operation.
Above, by $LType$, I mean any type of language that is known to belong to any type of Chomsky hierarchy. So it may be regular (Chomsky Type 3), CFL or ... |
The dwarves of the Black Forest live in houses that are each painted either red or blue. Some dwarves are friends, and some aren’t. Every so often, a dwarf will think about repainting his house. To decide whether to repaint, he looks at the colors of his friends’ houses. If his house is red, but more of his friends liv... |
Let $(A,\leq)$ be some finite poset. For $a,a' \in A$ we can determine in constant time whether or not $a \leq a'$. The height of an $A$ is by definition the greatest $n$ such that there are elements
$$
a_0 < a_1 < \cdots < a_n
$$
of $A$. By treating $(A,\leq)$ as a directed acyclic graph, we can determine the height o... |
What's the name for a DAG (directed acyclic graph) that has a unique root or source node from which every other node can be reached?
Alternatively, if you change the direction of the arrows, what's the name for a DAG that has some unique sink node that is reachable from every other node?
Here's an example graph:
|
Given a problem
List all steps to move n disks from rode 1 to rode 2.
I guess you are familiar with Towers of Hanoi rules.
I couldn't find a proper answer for the complexity class of this problem. My first guess would be NP or even NP-hard yet the output is exponential and no matter how hard we try there's no chance... |
I recently learned about Q-learning, a reinforcement learning technique that directly estimates the expected value of taking an action in a state.
I'm wondering if there exists techniques to do "dynamics learning", in order to estimate the dynamics of a system. A "dynamics learning" agent might choose actions which he... |
I tried to format my 32 GB SanDisk pendrive. But it showed me that " the disk is write protected" . I tried using CMD but it failed. I can't format it even using safe mode. Please help me to recover from this issue
|
Suppose I wanted to find a proof of the pigeonhole principle or show that no proof shorter than $L$ exists. I understand that proof-checking is in NP, so I could write a CNF formula that is satisfiable iff. such a proof exists. What I want to know is, how exactly would one do that? I understand I would assume a set of... |
To keep througput close to 1/cycle when there is a multi-cycle stage that sends a command to a far module then gets answer(10 clocks per send or receive), could separating it in two(send + receive) and putting idle stages(18x1 clocks) between them solve the problem?
For example, with just a single stage that takes 20 ... |
Im not sure if this the right place to ask but I'm wondering why a computer takes forever to open huge text file like 1GB but if I open a video file (mkv) for example with 10GB like a movie it will be opened very fast.
Why the computer doing this ? What is the difference between the two operations?
|
When solving an adversarial problem there are two basic approaches: one that takes into account the thinking process of both sides, and as opposed to that the non-psychological computations.
For example, in poker a computer can be programmed to simply compute the "best" moves for both sides, or alternatively could try ... |
I have it as a homework question to compare dual programs in the following way:
Take a canonical program and write its dual
Take the same canonical program, write it as a standard program, take the dual of the latter, then write it as a canonical program.
In the following image, option 1 is starting with the upper le... |
Lets define a counting PDA as equivalent to a PDA except that the transition relation can use the stack size.
Formally, let's define the transition relation as
$\Delta:Q\times (\Sigma \cup \{ \epsilon \}) \times (\Gamma\cup\{\epsilon\})\times \mathbb{N} \to P(Q\times (\Gamma\cup \{ \epsilon \}) )$
Meaning that $(q,\bet... |
I am currently solving a problem that I have reduced to computing the following function efficiently.
$$T_k(n) = T_k\left(\left \lfloor \frac{n}{2} \right \rfloor\right) + T_k\left(\left \lceil \frac{n}{2} \right \rceil\right)$$
The base cases are $\forall n < k: T_k(n) = 0$ and $\forall k \leq n < 2k: T_k(n) = 1$ No... |
Let's say my dictionary is {a,b}
I want to ccind a regular expression for the languge of the words that does not contain bbb in the most minimal way.
All I can think about is '+'ing between prefixes but I think that there is a way to get a shorter answer.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.