instruction stringlengths 35 29.1k |
|---|
I'm working on a formula that'll evaluate the partial sum of the harmonic series from $t_1$ to $t_n$. The problem is that I'm almost certain the final formula will include factorials. But if the formula has a factorial, then it's runtime complexity would be at least $O(n)$. And this would defeat the entire point of hav... |
The array max size is 10^5
I can only imagine on trying every possibility, on a O(n^2) solution, there is a better way for solving that?
Thanks a lot!
|
I have an algorithm that on each iteration generates a copy of an object containing a bit array and modifies it (the modification is limited to just 1 element per copy)
While doing the time analysis I cannot neglect the copy cost as this bit array is encoding information about the input set, so for a very large number ... |
Here is an example tree:
Each node has either $0$ or $4$ nodes. The values $v(n)$ of the node $n$ is given by $v(n) = v(\operatorname{parent}(n)) + k(n)$, where $k(n)\in \{2, 2.5, 8, 50\}$, such that a parent has childs of each value. Find the $K$ least nodes in a given tree (always ignore the root node). For our examp... |
I've seen several tables that list operation counts for matrix-inversion related problems, but none of them actually brought forward the way of computing them.
I'm interested in solving
Ax=b
for x, and k-diagonal sparse matrix A - which is a sparse matrix that has zero elements on all but k many diagonals. On these k... |
I have a sequence. And now for each element in this sequence I would like to know how many subsequent elements are larger. Or, in other words, I have a sequence $a_1, \ldots, a_n$, and for each $1\leq i\leq n$ I would like to compute $|\lbrace j|j>i\wedge a_j > a_i\rbrace|$.
My idea: Implement an AVL tree, put element... |
Wikipedia article on machine code and more in general Wikipedia's take on machine code seems pretty amiguous sometimes.
Often it makes me wonder if there's more, or it is just bad generalization.
Look at this:
Machine code or machine language is ......Numerical
machine code (i.e., not assembly code) may be regard... |
I am not getting enough literature on Vertex Disjoint/Vertex Capacited Min Steiner Tree Packing Most of the few papers that I have found refers to one reference which is not accessible over internet.
Korte, B., H. J. Pr6mel and A. Steger, "Steiner Trees in VLSI-layout",
in Paths, Flows, and VLSI-Layout, Korte, B., L... |
UPD: The following problem comes from error correction codes, to be precise -- either maximum-likelihood or belief-propagation decoding when the spectrum of special failing subsets is known (to some extent). Then the failure probability can be formulated as follows.
Let us say the universe set is $\mathcal U = \{1,2,\d... |
I am trying to solve a referee assignment problem, but I simply can't think of a way to relate my variable to one of the parameters, and I hope that someone in here can help.
I have the following binary variable
x(r,m) = 1 if referee r is assigned match m
and the following parameters:
time(m,t) = 1 if match m takes ... |
We know that NP is the class of languages recognized by a nondeterministic Turing machine (NTM) in polynomial time. I've also read that NP is the class of problems can be solved by NTM in polynomial time. It is clear that every decision problem can be seen like a recognition language problem, but if we have a function ... |
While reading an article, I noticed the use of term 'I/O Task':
Indeed, suppose the currently running process is performing an I/O
task (which, by definition, does not need the CPU to be accomplished).
Then, the OS may interrupt that process and give the control to one of
the other in-main-memory programs that are rea... |
None of the 4 possible answers have $\log n!$ in them
e.g. one of them is $O(n\log n)$
I tried solving, but I can't get why there is no $\log n!$ in non of the answers?!
|
Cook and Levin showed in 1971 how deterministically in polynomial time from every non deterministic Turing machine M, that halts in polynomial number of moves/steps, and string w to create the boolean formula $\Phi_{M,w}$ in conjunctive normal form that is true for each accept path/route of M on w and false for each re... |
I came across this explanation for count to infinity problem
However, i don't understand that after the BC link broke, followed by which B erroneously updated the path to C at a cost of 3; Now why will A update the cost to C as 4 (after getting updates from B) since its current cost to C is 2 which is lesser than that ... |
...
x = a / b;
For the above code, for example, is there a way to determine whether b could be zero at the time of division, even if the answer isn't 100% decisive? Can this algorithm generalize to check any property at a point of a program?
|
Today I had to prove some tautologies as an exercise, one of them was:
(Ga)->(Fb) equivalent aU(b v ¬a)
It is clear that I have to prove the implication in both ways. After putting into negation normal form i get that:
F(¬a v b) -> aU(b v ¬a) and viceversa.
I managed to prove the opposite implication, since aU(b v ¬a) ... |
Given two context-sensitive languages, $L_1$ and $L_2$ is the problem of "whether $L_1 \cap L_2$ also belongs to CSL" decidable?
I have the same question for the case when $L_1$ and $L_2$ belongs to Recursive/Recursively enumerable language. I think, they are decidable because they are closed under intersection operat... |
In regards to the quantum Fourier transform Page 845 of The Nature of Computation states
The amplitudes $\tilde{a}_\mathbf{k}$ are the Fourier coefficients of $a_\mathbf{x}$,
$$\tilde{a}_\mathbf{k} = \langle \mathbf{k}|\psi\rangle = \frac{1}{\sqrt{2^n}}\sum_\mathbf{x}(-1)^{\mathbf{k\cdot x}}a_\mathbf{x}\,.$$
Here $... |
Gödel defines in his System T primitive recursion over higher types. I found notes from Girard where he explains the implementation of System T on top of simply typed lambda calculus. On page 50 he mentions that once we use more types in the recursor we gain more expressive power with the system.
I don't understand how... |
Will a greedy method of picking the item that causes the largest difference each time lead to the optimal result in the minimum partition problem?
Let's say I have a set $\{a_1,a_2,a_3,...a_n\}$, now I have to divide it into two subsets so that the difference between the sums of the two subsets is the minimum possible.... |
How can we prove that the Halting problem is solvable by a machine with access to some oracle?
|
$L$ = $0^p1^q0^p$. Where $p, q \geq 0$
Here for any string $w \in L$ , I can have $u$=$0^p$, $x$ = $1^q$ and $v$= $0^p$ and $x^i$ will belong to L for all $i \geq 0$
So how do I prove it to be non regular using pumping lemma as there doesn't exist a string $w \in L$ which cannot be decomposed into the form $ux^iv$ for ... |
I tried to implement points location algorithm using Fortune's algorithm to get Voronoi diagram and another sweepline algorithm to locate many points in $O(n\cdot\log(n))$. If there are multiple concentric points on some step I get a pencil of radius vectors origins from the center of a circle. I need to sort them by a... |
I need to know which interpolation method is the best for working with reliefs, that is, to know the elevations or depths of a given terrain a set of points.
|
If M is non deterministic Turing machine and w is any string then $\Phi_{M,w}$ is satisfiable if and only if M accepts w according to Cook and Levin (1971).
By the definition of non deterministic Turing machine, M accepts w if and only if M has an accept computation on w.
But if all computations of M on w are accept th... |
I have the following program
x := y + 1;
if (y > 0) then
x := x + y
else x := y + 100;
x := x + y;
I want to compute the weakest precondition for getting {x = y} by executing this program.
The solution of this problem is the following
{(y > 0 & y + 1 + y = 0) | (y = -100)} = {( y > 0 & y = -0.5 | y = -100} = {false | ... |
I have the following background:
I have experience with object-oriented programming languages
I find Turing machines and the concept of a "procedure" very intuitive.
Yet I'm interested to understand the idea behind the abstract $\lambda$-calculus, and its application in the form of functional programming.
When I re... |
I am given weighted undirected and non-planar graph G=(V,E). I don't understand much about complex graph and how to work with them. So any tips will help.
For example like this
I don't know how to explain it but i will try.
Result should me like this: In every simple cycle (for example A-B-C-A) there should be at leas... |
I studied about Quantum Turing machine and i figured out that the difference between QTM and TM is in transition function and also if a problem is unsolvable by a TM then it is unsolvable by a QTM but I need a justifiable reason to claim QTM does not contradict with Church-Turing thesis.
|
I'm analyzing the computational complexity of an algorithm whose input size is $n$. Finally, I've ended up with
$T(n) = {m^\frac{n-1}{m}}$ where $m$ is a constant. Can one explain the type name corresponding to this computational complexity (e.g., exponential, etc.)?
|
For the purposes of this question, a maze is a spanning tree on a square grid (although the type of grid isn't super important).
There are many Maze generation algorithms, but they only work on a finite grid.
What if instead you are working on an infinite grid? But you only need to know finite of the grid at a time (th... |
Input: $M$ is non deterministic Turing machine that always halts in $cn^k$ moves/steps, where $c$ and $k$ are constants and $n$ is the length of the input string of $M$, $w$ is any string in $\Sigma^*$ and $a$ is another string in $\Sigma^*$ where $\Sigma=\{0,1\}$.
Output: Does $a$ represent a valid computation of $M$ ... |
If we had a language $$\sum = \{a,b,c\}$$
for a pushdown automata, and the transition
$$a;A/AA$$
means "If you read in an a and A is at the top of the stack, push A", then would you be able to push nothing if you encounter an a and A is at the top of the stack with the transition:
$$a;A/\epsilon \space C$$
I am new to... |
So I understand the idea that the decision problem is defined as
Is there a path P such that the cost is lower than C?
and you can easily check this is true by verifying a path you receive.
However, what if there is no path that fits this criteria? How would you verify the answer of "no" without solving the best pa... |
If $f(x)$ and $g(x)$ are two functions such that
$$f(x) \not\in \Omega(g(x))$$
does
$$\log f(x) \not\in \Omega(\log g(x))$$
hold?
|
I want to prove that $H(L_1 \cap L_2) = H(L_1) \cap H(L_2)$ is not always true.
If $L_1 = (ab)^*$ and $L_2 = (ba)^*$ with mapping $H(a) = 1$ and $H(b) = 1$, $H(\epsilon) = 2$, then $H(L_1 \cap L_2) = 2$ while $H(L_1) \cap H(L_2) = (11)^*$.
Is the above example correct to prove the above statement? Is it allowed to map ... |
Say we had a function $4^k$.
The asymptotic of this function would be $\Theta(4^k)$, and thus we would say the function has exponential run-time.
But what if $k = \log{n}$? Then our same function would be $4^k = 4^{\log{n}} = n^{\log{4}} \in \Theta(n^{\log{4}})$.
(Step 2 to 3 is accomplished via a change of logarithm ... |
What I am trying to do is determine "closeness" or how similar are arrays of integers (or byte arrays, doesn't matter). For example, let's say a = [0, 1, 2, 3, 4], b = [0, 2, 1, 3, 4], and c = [1, 4, 2, 0, 3]. Is there a function to determine that a is closer to b than c is?
So the function I am looking for I think sh... |
Reading about the Ski Rental Problem in Wikipedia, I got confused on the "when" is the buying of the skis occur. I could think of 2 possible ways, but each of them would have a different competitive ratio for a deterministic (and non- deterministic) algorithms:
Let's say that renting costs 1 dollar a day and buying cos... |
Given inorder and preorder (or postorder) traversal sequences of a
binary tree
balanced binary tree
binary search tree
of n nodes, what is the time complexity of creating the respective unique tree.
|
If $f:A^*\rightarrow A*$ and $g:A^* \rightarrow A^*$ are partial recursive we want to prove $h:A^* \rightarrow A^*$ with the following definition is partial recursive
$$ h(x) =
\begin{cases}
\lambda & f(x) = \lambda\\
g(x) & \textrm{otherwise}
\end{cases} $$
for $x \in Dom(f)$.
One of my friends tri... |
What is the grammar for language $L = \{ a^nb^m : n\neq m-1\}$?
I only know I have to write grammar for both $ n<m-1 $ and $ n>m-1 $, so this is what I wrote:
For $n<m-1$:
\begin{align}
&S\to Abb \\
&A\to aAb \mid \lambda
\end{align}
For $n>m-1$:
\begin{align}
&S\to aaA \\
&A\to aAb \mid \lambda
\end{... |
For example, when I look at some code like
int x = 1;
int * y = &x;
I can read it like
x equals 1
y equals the address of x
but how would I "read" something like
*y = 1;
My best guess is
The value at address y equals 1
But I'm wondering if there's a better way to think about it.
|
I am trying to prove that if $DSPACE(\log^2n) \subseteq NTIME(n^2)$ then $DSPACE(\log^3 n) \subseteq NTIME(n^2\log n)$ using padding, but I'm not sure if the claim is correct, or how to do the padding.
I tried to create for $L \in DSPACE(\log^3 n)$ the language $L_{\mathrm{pad}} = \{ x\#^{\log^3(|x|)-|x|}\mid x \in L\}... |
I want to solve the following formula:
$T(n)=T(n-1 )+ c\cdot\log n $, $T(1)=d$
I though about master but then I realized there is no dividing here so it's not gonna do it,
I tried to expand the formula like this:
$T(n-1)=T(n-2) + c\cdot \log(n-1)$
$T(n-2)=T(n-3) + c\cdot \log(n-1)$
How do I find the general formula?
H... |
I'm familiar with how Church numerals are defined in the lambda calculus, i.e. as functions that take two arguments and apply the first argument $n$ times to the second.
Then I have the successor and addition functions, both of which I managed to derive and understand:
$$\begin{align}
\mathrm{succ} &:= \lambda nsz.s (n... |
What's an algorithm for $k$-means clustering, in particular an online algorithm (you can stream new points to it), such that once the size of the set of clusters $k$ becomes large, we can still efficiently lookup a point $p$ and classify it into a cluster ID (an integer)?
Obviously standard $k$-means alone is not suffi... |
How does to prove that language
$$\textbf{X} = \{G \mid\text{ all connected connected components in $G$ are trees}\} \in \textbf{L}\,?$$ I know how to prove that language of undirected trees is in $\textbf{L}$ but I don't know what to do next.
|
I need to represent a family F of sets with some appropriate datastructure. The datastructure needs to support the procedures MAKE-SET(x), DISJOINT-UNION(A,B) and REPORT(A). I dont have a problem with implementing the procedures themselves. Its pretty straightforward if you follow the idea introduced in the chapter on ... |
The most common method of proving that some problem, P, is at least as difficult as some other problem, Q, is to demonstrate that Q can be solved in terms of P (with the usual caveats for the complexity of the reduction itself).
In particular, I'm thinking about the fact that breaking RSA encryption is believed to be a... |
Currently I am working on a Gomoku AI (or generally Connect-X games).
Implementing the search tree was no problem, but then I got to the point where I had to implement the value function and was surprised how difficult this is to make with a decent performance.
My question is what is the most efficient algorithm to che... |
In my exam preparation I stumbled across the follwoing exercise regarding pre and postconditions:
As far as I understood the question, we need to express some condition for p, such that if that condition holds for p, then we have that {true} p {true}.
The conclusion I got to when trying to think about it intuitevely i... |
I got stuck on the following note while reading a paper about computer security:
The stack mixes program data and control data
– by overrunning buffers on the stack we can corrupt the return addresses!
In fact, I didn't understand how a buffer overrun corrupts the return address within a stack frame. Also the use o... |
I just began reading Data Structures and Algorithms (Aho, Hopcraft, and Ullman). At the beginning, there is an example that discusses designing a traffic light for a complicated intersection of roads.
A visual is given of the intersection along with a table of incompatible turns ("turns" are considered to be any moveme... |
Again, the language is $L = \{w | w ∈ \{a,b\}^∗ ∧ |w|_a = |w|_b\} $
Now I'm unsure about what the '*' indicates. Whether it means that either a or b can be repeated, or only one of them or if you can repeat a pattern made of a and b.
An explanation would also be appreciated but I thought one or more examples of what wo... |
While studying ALU I came across this example, now what's difference between operations of OR Gate and SUM(Adder), in binary language
|
In this cryptography scheme, we take $g$ and $p$ (a large prime number). and taking the customary clients Alice and Bob who chose $a$ and $b$ secretly whereas $p$ and $g$ are known in public. I haven't mentioned the other requirements taken into consideration for selection of these parameters.
So here is how this works... |
Working for my exam, this question popped up.
Given the production rules below, draw a pushdown automaton to recognise the language it generates:
S → AB
A → BA
B → BB
B → T
T → b
Questions:
1. Since A has no empty transition, wouldn't this just end up in an infinite loop?
2. What order are the values entere... |
Consider the following two snipets of code:
If a >= 5:
If b == 0:
....
Else:
....
Else if a <= 5:
....
If a > 5:
....
Else If a >= 5 and b == 0:
....
Else If a >= 5:
....
Then these two constructs are logically equivalent. I am interested if there algorithms that detects if two or more co... |
Given a matrix $A \in \mathbb{R}^{m \times n}$ that describes a zero-sum game. What are necessary and sufficient conditions for cases in which the k-th pure strategy of the row-player and the l-th pure strategy of the column-player are simultaneously optimal.
If I understood the definition of a saddle point correctly, ... |
In a public transportation network each stop has an assigned zone. The price of a trip depends on the number of adjacent zones that the user touches during a given trip. If the user touches two adjacent zones it must pay a Z2 title, and it can travel with that title during 1 hour. The time to travel (and price) increas... |
I often read in Complexity literature that NP∩coNP is unlikely to have any complete problems. Is that unlikelihood "proved" ?
By proved, I mean that there would be a theorem that would relate the existence of such a problem to, by instance, the collapse of PH, or any other equality that is strongly believed not to hold... |
CLRS explains B tree key deletion as follows:
If the key $k$ is in node $x$ and $x$ is a leaf, delete the key $k$ from $x$.
If the key $k$ is in node $x$ and $x$ is an internal node, do the following:
a. If the child $y$ that precedes $k$ in node $x$ has at least $t$ keys, then find the predecessor $k'$ of $k$ in the... |
How to present (code into) an expression consisting of brackets and following operations: +, -, / and * into a binary tree. Then, I need to write an algorithm that will derive that very tree.
Any hints or suggestions on how to do this?
I've tried placing brackets and operands into the leaves, but I'm not even precisely... |
so the book that I'm reading says this is a deterministic context free language
$L = \{a^n b^n | n>0 \}$ $\cup$ $\{ a^n b^{2n} | n < 100 \}$
But i think this is wrong Because :
at the beginning of building the DPDA, we have to decide whether we should go with the first one or the second, and considering both of them... |
Let's say that $N$ is the number of vertices. We want to create a graph where only two vertices have the same degree. For what kind of $N$ is this possible?
I tried it and I've been able only to come up with such where $N$ is $3$ and $4$.
|
Is fuzzy logic in any way applicable to general-purpose language design? If yes, then how would a computer language theoretically benefit from first order support of fuzzy logic?
|
What's the running time of:
foo(n)
if(n==1) return;
int i=1;
while(i<n)
{
i=i+2
}
foo(n-2)
There are $n/2$ recursive calls to foo but how to add to the calculation the while loop
|
If we consider a machine that uses 64 bits to represent a number.
If 1 bit is used for sign, "x" bits to represent mantissa and (63-x) to store the (biased) exponent in a manner similar to the IEEE representation.
I'm using this question to check my knowledge of IEEE. Can we say the largest positive number using this m... |
Page 854 of The Nature of Computation states the following (This discussion has made the simplifying assumption that $M/r$ is an integer):
If each of the observations gives us a random harmonic, how long does it take to learn the fundamental frequency? Suppose we observe the frequencies $k_1 = b_1 M/r$, $k_2 = b_2 M/r... |
I first learned big-Oh (little-Oh, big-Theta.....) complexity for growth of functions using CLRS in a computer science class.
Now I am doing a project on optimization. In our optimization class, we were introduced to the notion of rate of convergence which are characterized by the ratio:
$\lim\limits_{k \to \infty} \df... |
For this problem, I heard that using a difference array can solve the problem but I can't seem to figure out how to solve this problem. Could anyone give me some advice? Please keep it simple since I am only a high school student preparing for the national infomatics Olympiad.
Given an array of numbers, we can constru... |
While reading a chapter about FSM, I was stuck on the following slide:
In fact, I have been unable to determine what are "state registers" and "code registers", which were not explained in the course. Therefore, I have used to search for the definitions on the net, but I haven't yet found any result.
|
I'm working on exercise 16.3-5 of CLRS:
Prove that if we order the characters in an alphabet so that their frequencies are monotonically decreasing, then there exists an optimal code whose codeword lengths are monotonically increasing.
Perhaps I'm misunderstanding the question, but how can the lengths be monotonicall... |
I am going through the following series of lectures on OS development .
http://www.brokenthorn.com/Resources/
In the fourth tutorial , I came across the term " OEM" parameter block that stores the windows MBR and the Boot-record information whose soul purpose is to describe the file system on the disk .
And then on mo... |
So, the task is to prove the following:
If S is a schedule containing at most one write action, then S is conflict-serializable.
The answer is yes, but I disagree, because the following schedule contains at most one write action, and is not conflict-serializable:
R1(A), R2(A), W2(A), R1(A).
Am I completely wrong? O... |
Does anyone know how to solve the below?
I'm guessing that I need to use the Subtraction method or iteration but still I'm having a hard time with it.
$$T(n)=3T(n-1)+3^n\times n^2$$
|
We have the following Lemma and proof:
Lemma 5.5. If $A$ if FPT, then $A\leq_{\mathrm{fpt}}$ Independent Set.
Proof. We reduce $A$ to Independent Set parametrised by $k'$, where $k'$ is the size of a sought independent set. Given an instance $(x,k)$ of $A$,
solve $(x,k)$ in $f(k)\cdot \mathrm{poly}(|x|)$ time, (the r... |
So i know that DCFL is not closed under union, but what about union with RL?
Because what if both of the languages can start with the same string?then when we are building the DPDA for the union and for example both of them can start with $a$ then how can we determine whether its for the RL or for the DCFL?
|
Arora-Barak says
It has also happened a few times that the first polynomial-time
algorithm for a problem had high complexity, say $n^{20}$, but soon
somebody simplified it to say an $n^5$ time algorithm
What are some examples of the above statement? I know AKS is one, are there any other?
|
$ L = \{ w ∈\{0,1\}^* \mid |w|_0 = |w|_1 \mod 5 \}$
So i tried figuring out why this is CFL and whether its DCFL or not but i couldn't come up with any PDA!
I'm studying for my exam and this was on the book, the book says its CFL but doesn't say whether its DCFL or not and does not draw any PDA for it!
i tried m... |
I am given a connected, weighted undirected graph.
I must obtain minimum possible weight sum of "marked" vertexes in the graph.
Vertexes must be marked so that each simple cycle contains at least one "marked" vertex.
I will approach this problem by:
using DFS on each node to obtain list of all possible cycles. I must... |
Why does an NFA that accepts/rejects bit strings implemented with a Recursive Backtracking algorithm outperform one that is written using a Parallel Bitmap search?
set up two tests for these algorithms, to evaluate on both different length strings, and different numbers of inputs:
First, I created sets of 1,000 rando... |
I am given an array $A$ having $n$ elements and an integer $k$.
I need to find the longest subsequence which always includes the first element and the subsequence follows the given condition:
for all $i < j$: $|A[i] - A[j]| \leq k$.
Example: $n= 4$, $k = 5$, $A = [1, 2, 50, 6]$
Answer: the longest valid subsequence, ... |
Let's define the following languages over the alphabet $\Sigma=\{0,1\}$:
H10 is the language of all strings that are encoding of diophantine polynomial equation with integer coefficients and $n$ unknowns/variables that has at least 1 integers root/solution, i.e. there exists a root/solution in $\Bbb{Z}^n$ that solves t... |
This problem takes place on a coordinate plane. I need assistance in creating the algorithm to solve this problem. I am solving this problem in java if you are interested.
I have 1 carpet and 2 tarps.
The 1 tarp covers the carpet (note in some scenarios it may not cover it at all).
The second tarp will cover the remain... |
I am trying to solve this problem and I am stuck. I think it is B, but I think I'm wrong. Thanks.
Which of the following expressions is TRUE if and only if NOT all three variables a, b, and c have the same value?
A. a != b || b != c
B. (a == b || b == c || a == c)
C. a >=b && b >= c && c >= a
D. a > b || b > c || a >... |
Im struggling to understand how to transform Nondeterministic finite automaton (NFA) of the following form:
To a regular expression equivalent. What I have tried was using arden's rule. However I just cant figure out how to simplify and return the appropriate regular expression corresponding to that NFA.
First I have ... |
In this question
Farewell Stack Exchange suggested to use karnaugh maps to solve the satisfiability problem by simplifying the entire/whole boolean formula by simplifying subformulas until you have reached a contradiction or the current boolean formula cannot be simplified anymore.
ratchet freak answered that this meth... |
$h(i,k)=(h^{}_{1}(k)+i * h^{}_{2}(k)) mod |T|$
as it defined in wikipedia
I would like to know if it possible that Double Hashing return the same value for given $k$ when $i=1$ and $i=2$. Or from the other side, is it possible to build $h^{}_{2}$ in such way to that it never happen?
|
Let us define the following languages:
$$ {L_1 = \{\langle M\rangle : M \ \text{is a TM and $\exists w\in \Sigma^*$ s.t $M(w)$ repeats a configuration infinite times}\}} $$
$$ L_2 = \{\langle M\rangle : M \ \text{is a TM and on all inputs there exists a configuration that repeats infinite times}\} $$
My questio... |
I am given the the coefficients for an ellipse in the form:
$$Ax^2 + Bxy + Cy^2 + Dx + Ey + F=0.$$
I have a 2 dimensional array of point objects (in Python) called "pixels", and I need to give each point a "count" if they lie inside the ellipse.
I initially tried iterating through every point with a loop like:
for row ... |
Suppose, in the context of the classic marriage problem, two equal size groups of $n$ men and $n$ women are being matched, with the GS algorithm.
If a man were to switch the order of a pair of women, low on his preference list, say $x$ and $y$, would this yield any sort of advantage with regards to being matched with a... |
This is more of a practical question for me, but I have a few team members $n$ who I'd like to sort by two characteristics (just call them $a$ and $b$ for now). These characteristics are just a rating (given from 1-10). Among these $n$ team members, I am trying to find those who fit a definition of being good i.e. give... |
Let < M > be an encoding of a Turing machine.
L = { < M > | M is a Turing machine that accepts a string of length 2014 }
Above language is R.E(even though we have infinite TM's) as we have finite amount of strings of length 2014 and we can apply dovetailing method.
My doubt is can we apply dovetailing if we have infin... |
Grammatical Framework is based in Abstract Categorial Grammars. It is known that Combinatory Categorial Grammars have grammar induction/learning capabilities see e.g. https://link.springer.com/article/10.1007/s11168-007-9026-2 and there are also works about statistical learning in Cornell Semanatic Parser framework. Bu... |
As the title says, i have the following excersice:
An associative mapping cache with four lines in each set, can store in each line two words of 16 bits each. It can store 4K words, that they have length 32bits from Main memory. The CPU is 16 bits and the address that he produces is 24 bits length. So the solution is ... |
Suppose that we have an array $A$ of $n$ elements with some partial order known, e.g. for example as a $n\times n$ matrix containing $c_{ij} \in \{-1, 0, 1\}$ where $0$ represents unknown and $-1, 1$ represent $A_i < A_j$ and $A_i \geq A_j$ respectively.
Is there an efficient algorithm that counts the number of partiti... |
I've finally more or less understood the recursive algorithm for solving the Towers of Hanoi. My Python code is below.
However one thing still bugs me - I can't yet work out how this simple seeming algorithm can "know" which move to make first - whether to the destination peg or the spare peg.
I can see it depends on w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.