instruction stringlengths 35 29.1k |
|---|
I am quite new to Red-Black trees, and therefore I am having a bit of difficult time trying to understand them.
One of the properties of the Red-Black tree is that every red vertex must have two black children, meaning one cannot have two consecutive red vertices.
Can someone explain to me why this is an essential prop... |
Assume a list $L$ is to be sorted using the following variation of insertion sort: For $2 \le i \le n$, to insert key $L[i]$ do a binary search on the list $L[1..i-1]$ to find the correct position.
How many key comparisons are done in the worst case?
I think the worst case is when $L$ is sorted in reverse order, whi... |
From Wikipedia, an affordance is:
a relation between an object or an environment and an organism, that
affords the opportunity for that organism to perform an action
Previously what approaches have been used to encode this in an embodied intelligence? In other words, has anyone tried to get a robot to understand th... |
I am trying to reduce the complement of the HALTING problem (WLOG, the complement of the HALTING problem is the language of TMs that loop on some string w)to this language in order to show that it is not recognizable. Does anyone know how to do this reduction, what I come up with is:
Using python-like syntax:
def R(<M... |
I have an input number c of n bits and its prime factorization. I want to find a divisor of c with certain fixed bits "f". For example:
INPUT:
c=1100011 (99) (n=7)
prime factorization = 11,11,1011 (3,3,11)
f=0??1?0?
OUTPUT:
o=0001001 (9)
Unfortunately, it's no use to check all divisors, because according to http://en... |
I'm reading Introduction to Algorithms and would like to know if learning the proofs is worthwhile.
|
I am reading this paper for my master thesis and trying to understand every concept in it. The following sentence confuses me as to what is the exact definition of a dictionary in this concept except for the fact that it holds the atoms as its columns?
Recall we refer to the columns of the matrix $A$ as atoms that are... |
The cover time of a graph is the expected number of steps in a random walk on the graph until we visit all the nodes.
For undirected graphs the cover time is upperbounded by $O(n^3)$.
What about directed graphs? I'm looking for examples of super-polynomial cover time.
Is there an example for such graph with $O(2^{\sqrt... |
So, in generic program analysis, we have a lattice $L$ with a join operation $\sqcup$, program with statements labelled, and for each label $b$, a transfer function $F_b : L \rightarrow L$.
The goal is to find, for each label $b$, a fix-point $x$ such that $F_b(x)=x$. This is a common approach used in dataflow analysis... |
I usually find this in the context of asking about NP-complete problems, but any decision problem works. We start by assuming there's a polynomial time algorithm that gives the yes or no answer. If it's yes, how can we go from that to finding a polynomial-time algorithm that gives the certificate?
For example, let's sa... |
My problem: Define two sets P and Q of words (that is, two problems) such that: P is undecidable and not semidecidable, Q is undecidable and semidecidable and P ⊂ Q
|
Is it the task of the software (operating system) to detect stack overflows or is a stack overflow detected in hardware, causing an exception in the CPU?
|
I'm doing some classification experiments with decision trees ( specifically rpart package in R). By setting the depth of a decision tree to 10 I expect to get a small tree but it is in fact quite large and its size is 7650. So what is exactly the definition of size (and depth) in decision trees?
PS: my dataset is quit... |
Anyone could correct me that Why just (1) is False. i'm not sure why others are true: ( G is a Context Free Grammar). any brief description?
There is an algorithm that decides whether the complement of $L(G)$ (language generated by $G$) is empty or not.
There is an algorithm that decides whether the reverse of $L(G)... |
Anyone can describe why $L_{1}$ is not the complement of $L_{2}$, and why $L_{2}$ is not context free?
$$L_{1}= \{w_{1}cw_{2} : w_{1},w_{2} \in \{a,b\}^{\ast}, w_{1} \neq w_{2}\}$$
$$L_{2}= \{w_{1}cw_{2} : w_{1},w_{2} \in \{a,b\}^{\ast}, w_{1} = w_{2}\}$$
|
I would like to rate a set of $n$ elements, with each element assigned a rating from ${0,\dots, 10}$.
The way in which I want to rate is by repeatedly selecting subsets of $k$ elements and querying a user to rank them relative to each other. I would like a means of minimizing the number of necessary queries to assign r... |
Alphabet: abc
Sample input:
abc
cba
aabbcc
aaabbbccc
caac
Sample good outputs: acb, cab, cac and others, since they are not substrings of any other, and because all strings of length 1 and 2 are present.
Sample bad outputs:
aab since it is a substring of 3)
aaaa because it is not minimal: we have other solutions wit... |
How can I efficiently generate the first N elements of the sequence $3^i 5^j 7^k$, where $i,j,k \in \mathbb{N}$?
I've googled around a bit and found the sequence in OEIS, but I don't really see a simple way of generating it.
|
I am trying to show that the sum of $\log n$ $n$-bit integers can be computed in $\mathsf{AC^0}$. I know that the iterated addition is computable by fan-in $2$ circuits of depth $O(\log n)$, so the sum of $n$ $n$-bit integers is in $\mathsf{NC^1}$. This means that the bound is very tight. I found somes notes here which... |
There is a hint for part B, but I do not get which ones are the right cases to get rid of both goblins. Thanks!
How can I tell who is a truth teller and who is a liar?
|
Is it possible to compare PDA having N-Stacks with Turning Machines. Are they equally powerful in this situation?
It's been told that PDA with 2-Stacks is equally powerful to Turning Machine. But what if we add more stacks i.e. 3, 4, 5...N to PDA; will it become more powerful or it can serve same purpose.
|
I'm studying Hoare logic and I can't understand the relation between partial and total correctness regarding loop invariant. Suppose for example that I have the following program:
{X ≥ 0}
Y := 0;
Z := 0;
{Y =2Z}
while (Z ̸= X) do (
Z := Z + 1;
Y := Y + 2 )
{Y =2X}
The solutions says that for partial correctness I can ... |
Say I have some computation model/programming language $M$ (e.g. Turing machine or equivalent), and let $C_M$ be the set of all partial or total functions $f : \mathbb{N} \to \mathbb{N}$ computable by that model. Also, assume that $C_M$ is countable.
Now let $B = \{ B_1, B_2, ... , B_n \}$ a finite set of computable ba... |
In binary a unit (bit), can store 2 separate values.
if you have ternary, then a unit can store 3 separate values.
why then don't computers use higher bases, for example in ternary you could have 3 different voltages, and even if transistors got a little bigger, wouldn't it still be more efficient?
|
In my parallel algorithms class, the PRAM model is described as having an "arbitrary number of processors, bounded by some polynomial in the input size."
I think that this may be missing a constraint. For example, this would imply that finding a Hamiltonian cycle is in NC:
If I give all of the permutations of the vert... |
I've joined computer science classes at high school because I have a wide knowledge and a few years of experience in programming in multiple of languages, however I didn't fit in the requirements of the class, which is a specific mathematics level. I am a low level mathematics student, I don't really know formal mathem... |
In Richard Karp's paper "Reducability among combinatorial problems" he lists 21 NP-Hard problems. Though I can somewhat understand the ideas and motivation behind the paper I am searching for some clarity.
From what I know and understand this paper showed the parallels between the various problems. Specifically that t... |
Lets say you have a language $L$ and you want to determine if it is context free.
Context free languages intersected with regular languages are context free. Is that enough to prove that $L$ is context free?
Meaning, given a regular language $P$, if
$$L \cap P = T$$
where $T$ is context free, is $L$ is context free?
Le... |
I've been working on a problem for my Algorithms class, but I've found myself stuck. The prompt is as follows.
You start with an empty room and a group of n people waiting outside. At each step, you may either admit one person into the room, or let one out. Please design an algorithm which generates a sequence of $2^n... |
It is being said that 'Eugene Goostman', a computer programme developed to simulate a 13-year-old boy, managed to convince 33 per cent of the judges that it was human, and thus passed the Turing Test.
The computer programme, aka a chatbot, was pretending to be a 13-year-old Ukranian boy for whom English was a second la... |
A colleague came up with the following search algorithm:
We have an array of sorted, distinct integers [$i_0$ < $i_2$ < ... < $i_n$]
We are looking for the index of $i_k$ (for simplicity suppose that $i_k$ is in the array)
We suppose that the elements are pretty uniformly distributed between $i_1$ and $i_n$
The algor... |
https://cstheory.stackexchange.com/a/3627/32204
Could someone explain to me why this reasoning is false. I don't understand it! To me this sounds plausible!
|
In the wiki article about closures one can read:
closure ... is a function or reference to a function together with a
referencing environment
At the same time in the wiki article about class methods:
Accessor methods are used to read data values of an object. Mutator
methods are used to modify the data of an obj... |
Given an undirected graphical model with no edges and only N nodes, I am trying to find a closed form solution to the ML estimate of each node given that
$p(x|\theta)=\frac{\exp(\sum_{s\in V}\theta_sx_s)}{\sum_x\exp(\sum_{s\in V}\theta_sx_s)}$, where $x=(x_1,\ldots,x_N)$ and the denominator is the partition function. I... |
For problems like Knapsack there is a pseudo-polynomial time algorithm and it is NP-complete. So we reduce every other problem in NP in polytime to Knapsack.
But why don't we have then a pseudo-polynomial time algorithm for all problems in NP?
|
According to Galvin and Silberschatz, 5 queues are maintained in multilevel queue scheduling, each for:
System Process
Interactive Process
Interactive Editing Process
Batch process
Student Process
where System process has highest priority and Student process has lowest priority.
What is meant by Student Process... |
I'm trying to reproduce the synthetic networks (graphs) described in some papers.
It is stated that the Barabasi-Albert model was used to create "scale-free networks with power-law degree distributions, $P_A(k) ∝ k^{-λ}$".
$P_A$ is a probability distribution that returns the probability of a node having degree $k$. For... |
I know that there are problems that cannot be solved by any algorithm, such as the Halting problem.
I also know that some processes cannot be even adequately approximated by any Turing Machine (equivalently, any digital computer), meaning that some property of the process cannot be simulated due to its intrinsic nature... |
I know exactly what a partially computable function is, but I've seen a few functions that I really can not understand why they are not partially computable. As an example in Davis book page 78, he says the following function is not partially computable: ($\uparrow$ means undefined and $\downarrow$ means defined)
Given... |
The following is a question from the textbook Introduction to Algorithms, however a solution to the problem is not given...
Professor Marley hypothesizes that he can obtain substantial performance gains by modifying the chaining scheme to keep each list in sorted order. How does the professor’s modification affect the... |
I'm trying to reproduce the synthetic networks (graphs) described in some papers.
The topic is the same as a previous question of mine, but with a different focus.
It is stated that the Erdos-Renyi model was used to create $2$ networks with average degrees $\langle k_a \rangle$ and $\langle k_b \rangle$.
In the first p... |
I use a variation of a 5-cross median filter on image data
on a small embedded system, i.e.
x
x x x
x
The algorithm is really simple: read 5 unsigned integer values, get the highest 2, do some calculations on those and write back the unsigned integer result.
What is nice is that the 5 integer input values ar... |
I needed to sort vertices into buckets as an optimization for collision detection later. I came up with this:
Go over all the vertices and count the size that each bucket needs to be to contain them into an array.
Shift the size array index by -1 unit and use it as offset array instead.
Create a single array for all t... |
Right now I am doing some problems on application of decision tree/random forest. I am trying to fit a problem which has numbers as well as strings (such as country name) as features. Now the library, scikit-learn takes only numbers as parameters, but I want to inject the strings as well as they carry significant amoun... |
For a rational number 1/3 below is the floating point representation(64 bit) of decimal expansion 0.3333333....
As per the above bit structure, I would like to interpret the value of exponent(11 bits) and value of fraction(52 bits).
exponent has
11 bits. How do I interpret exponent value?
fraction has 52 bits.
H... |
In the network clearance problem,
we are given a simple undirected graph with a capacity assigned to each edge (and/or to each vertex).
Each edge can transport up to its capacity each time step (i.e., if the edge has capacity 2, it can transport 2 units of flow in each time step).
Each vertex is either a source vertex ... |
Anyone could apply some theorem to prove this is not context free? I read lot's of material. it's not homework, it's not exam, it's not anythings. I want to learn, if some people try to answer this question one year later, it's not important, but anyone try to learn me.
$$L_{a}= \{w_{1}cw_{2} : w_{1},w_{2} \in \{a,b\}^... |
I was wondering in how to solve this question, I feel a bit confused: for $\Sigma = \{1,\#\}$, consider
$$D=\{w \mid w=x_1 \# x_2 \# \cdots \# x_k \text{ for } k \geq 0, \text{ each } x_i \in 1^*, \text{ and } x_i \neq x_j \text{ for } i \neq j\}.$$
I want to know how to prove this is not regular using pumping lemma.
|
I'm not sure whether my definition for these 2 terms are correct. Hence, could you help me verify that:
HeapSort: A procedure which sorts an array in place.
Build-Max-Heap: A procedure which runs in linear time, produces a max- heap from an unordered input array.
Is worst-case input = worst-case running time?
If so, g... |
I'm adapting an algorithm for calculating a CRC 16-bit CCITT (XModem) value from an ASCII input. I've found some code here. I'm using the function the poster has in his question, but I've noticed at the bottom he does this:
calcrc = crc And &HFFFF
What's the purpose of applying such a bit mask that is all 1s to a val... |
How can a finite automaton over(0,1) doesn't accept any string? I only can think of
s->a->q->F
Where the final state F is empty set. Is that true please?
|
It is clear, that NP ⊆ PSPACE holds and that it is unknown if the strict inclusion holds. How is it if one looks at the corresponding functional complexity classes? Does FNP ⊂ FPSPACE hold?
|
How would I go about constructing a nondeterministic 1-counter automaton for the language $L$ that is the complement of the palindromes $\overline{L}=\{ww^{rev}\}$ over a 2 symbol alphabet $\Sigma = \{0,1\}$?
The definition I am using for 1-NCAs consists of:
$S$, the set of states,
$\Sigma$, the alphabet ($\Sigma = \... |
I'm looking for an algorithm to perform set intersection where set $N_1$ is very small and set $N_2$ is very large.
Due to the constraints of the problem I am solving, I cannot rely on an algorithm which sorts or depends on sorted elements. Further, the simple method of performing $N_1$ hash look ups in a hash table... |
I'm requesting references for LL(k) in situations where k > 1 for reasons described below.
I'm looking for research/notes/anything involving LL(k) predictions.
Any time I look up LL(k) I end up with the description starting about LL(k) and focusing on LL(k) where k = 1.
Is there a formal description for the process t... |
I'm planning on making a fiber art $K_{37}$ (like the one I laser etched with help: K37: The complete graph on 37 nodes, svg). To accomplish this, the plan is to construct 37 pegs equally spaced in a annulus made from wood and then to string yarn between them. Since $K_{37}$ is a complete graph, it has a Hamiltonian pa... |
What would be an example of a worst-case input for Build-Max-Heap? What would the "shape" of it "look like"? I'm having trouble getting a feeling for it.
|
Sets $A$ and $B$ are given but we don't know what kind of sets they are. If we know that $A \cap B$ is recursively enumerable is it true to say that both $A$ and $B$ are recursively enumerable?
what about $\cup$ and $\times$ operators? If $A \cup B$ or $A \times B$ is recursively enumerable is it true to say both $A$ a... |
Is there active research work on creating computational models of a "specific" person's behaviors (general behaviors, emotions, actions...)? What are some references for such research? I tried google and scopus and did not have much luck.
I have worked on modeling movement behaviors of pedestrians in crowd (for my PhD ... |
I am not sure if this is the right place , but:
Is there an algorithm for solving $n\times n \times n$ rubik's cube (non-trivial one)? If so how efficent is it? Now say I have a $n \times \ldots \times n$ ($d$ times) rubic cube , is there an algorithm that works effiecently for this case?(of course now it depends also ... |
I know that for positive monotonically non-decreasing functions, f(n) and g(n),
f(n) = O(g(n) + c) entails
f (n) = O(g(n))
Why is this always true only for positive monotonically non-decreasing functions? $\Theta$
If there exists one, give a counter-example that shows that the above Big O rule is not necessarily true... |
Rice theorem says every non-trivial property of languages of Turing machines is undecidable. what is the meaning of undecidability here? is it semi-decidable?
As an example the following language is R.E but it contains a non-trivial property
$A = \{x | \phi_x$ is defined for at least one input$ \}$
this language equal... |
I'm looking for relatively new reviews of research work on partial evaluation. The most recent work I've found is "Tutorial notes on partial evaluation" by Charles Consel and Olivier Danvy (1993). The book Partial Evaluation and Automatic Program Generation (1993) also gives a comprehensive overview of the work in this... |
I want to show that
$\qquad\displaystyle O = \{M : M \text{ is a DFA}, |L(M)| = 1\}$.
Here $|L(M)|=1$ means the DFA contains only one state. I really don't know where to get started in this problem.
Should I do something like this?
M = On input (M',w) where M' is a DFA and w is a string:
- If M' accept only one mem... |
Question:
How are hash table's values stored in memory such that space if efficiently used and values don't have to be relocated often?
My current understanding (could be wrong):
Let's say I have 3 objects stored in a hash table. Their hash functions generate these values:
0
10
20
I would presume that the pointers of... |
Given $n$ rows with $k$ columns, is there a storage mechanism/data-structure and/or algorithm that enables dynamic restructuring such that I can get the top $t=\mathcal{O}(1)$ results efficiently?
Example strategy 0
$$k_0 \le k_1 \le \cdots \le k_{n-2} \le k_{n-1}$$
Example strategy 1
$$k_{n-1} \le k_{n-2} \le \cdots \... |
While trying to improve the performance of my collision detection class, I found that ~80% of the time spent at the gpu, it spent on if/else conditions just trying to figure out the bounds for the buckets it should loop through.
More precisely:
each thread gets an ID, by that ID it fetches its triangle from the memor... |
I have an acyclic edge-weighted graph and have used Dijkstra's Algorithm with topological sort to find any shortest path to every other node from a root $s$. This is performed in time proportional to $V + E$, where $V$ is the number of vertices and $E$ the number of edges. I have $V= N^2$ vertices in my graph. Now supp... |
I have seen that in the material made by Andrew Ng about neural networks, he uses the following weights:
so when I replace the final values of h_theta(x) in the formula:
I got values near 0 and 1.
The problem that I have is when I use the values that are in the Tom Mithell book about Machine Learning, he uses the val... |
Imagine:
you are monitoring a system, and want an alert when certain measured value goes over a threshold value X.
But perhaps the measured value is constantly fluctuating close to X, and you get a lot of alerts.
There's an solution to that, where you only get new alerts when the measured value has dropped to below Y ... |
Does anyone know of an algorithm that can solve the following special case of SAT in polynomial time? Are there any algorithms that can solve the counting (#SAT) version of it in polynomial time?
Special case:
If clause $a$ and clause $b$ have one or more variables in common, that is, there exists some variable $x$ tha... |
My confusion is that if the recursive call calls the left nodes, and then adds with the right nodes, how are the nodes that are to to right of the left nodes and vice versa being called?
int size (BinaryNode t) {
if (t == null)
return 0;
else
return 1 + size(t.left) + size(t.right);
}
|
In Computer Architecture course, I have learnt how computer performs numerical computations.
While using MATLAB, I was introduced to symbolic mathematics toolbox.
I was amazed to see it manipulating trigonometric expressions, indefinite integration etc.
What sorts type of algorithms are used for doing symbolic mathemat... |
following question on undirected graph without weights can be solved by using DFS and in O(|V|+|E|) times.
check that G is bipartite.
check G has one simple cycle.
find number of connected component G
with given two vertex u, v, find a path between u and v with minimum edges
anyone can describe, how the authors of t... |
It's possible to parse a document using a single pass from a state machine. What is the benefit of having two passes, ie. having a lexer to convert text to tokens, and having a parser to test production rules on those tokens? Why not have a single pass that applies production rules directly to the text?
|
Usual parallel algorithms require a number of processors that grow with the size of the input, usually $O(\log n)$ or $O(n)$.
This is great from a theoric point of view, but strange from a practical point of view, where the number of the processors that we can use is bounded by a constant. A corollary of the Brent Theo... |
I have a simple recursive solution as below:
public int countPaths(int x, int y) {
if(x == 0 && y == 0) {
return 0;
} else if(x == 0) {
return 1;
} else if(y == 0) {
return 1;
} else {
int count = countPaths(x-1, y);
count += countPaths(x, y-1);
return co... |
Every time I think I get what Rice's theorem means, I find a counterexample to confuse myself. Maybe someone can tell me where I'm thinking wrong.
Lets take some non-trivial property of the set of computable functions, for example let $L = \{ f : \mathbb{N} \to \mathbb{N} \;|\; \text{f is a computable and total functio... |
A [smooth number] is one whose factors are all "small". For a computational problem, I would like all smooth numbers up to $10^8$.
I think it's unfeasible to factor a billion numbers. Instead, I am choosing a set of primes, $P = \{2,3,5,7,11,13,17,19,23,29,31\}$. How can I find all possible product of them less th... |
I need to evaluate if the picture was resized (upscaled). Are there any approaches to that already? If not, what do you recommend me to start with?
|
I have a program that fills a matrix of size N with characters such that all words formed by each row satisfy one regular expression, and all the words formed by each column satisfies a second one.
For example, say I have $N=3$, regular expression $c^*ab^*$ for rows and $b^*ac^*$ for columns. A solution would be
$\qqu... |
I am reading the book: "Code: The Hidden Language of Computer Hardware and Software" and in Chapter 2 author says:
Morse code is said to be a binary (literally meaning two by two) code
because the components of the code consists of only two things - a dot
and a dash.
Wikipedia on the other hand says:
Strictly speak... |
I tried it as follows and would like to know if it is correct.
|
I went through the algorithm’s for finding the LCA of two nodes in a binary tree (let’s say the values are random – not a binary search tree) and I chose the method where the path to root is stored in an array. That is, an array stores the parent values from one node to the root and the same is done to the second node ... |
For example $-\tfrac9{16}$.
$$\tfrac{9}{16} = \tfrac{1}{16}+\tfrac12 = 0.1001\,,$$
which when normalised becomes $0.1001\times 2^0$. Can its mantissa be $0.0001001$ in 8 bits?
If so, as $-\tfrac9{16}$ is negative, twos' complement is done to make its mantissa $1.1110111$.
How do we normalise that?
|
I recently came across the paper "QMDD: A Decision Diagram Structure for Reversible and Quantum Circuits" by Thornton and Miller. It deals with a way of compactly representing transformation matrix for a given quantum circuit or a quantum gate. I tried very hard to construct a QMDD of a Toffoli gate but I failed. Then ... |
This question is inspired by the Bogo-Sort algorithm and the discussion of whether there are any worse sorting algorithms than Bogosort.
Assume that $A$ is an array initialized by a random permutation on the set $I_n=\{1,2,\ldots, n\}$.
Consider the next algorithm:
While $A$ is not sorted:
Pick two random numbers $i\... |
Has the following version of the stable matching problem been studied?
There are $k$ types of objects.
There are $n$ producers, each of whom can produce a single object of any type, and has a personal preference relation over the objects (e.g. Bob prefers to produce shoes, then socks, then cars, etc.).
There are $n$ c... |
Given matrices $A \in \mathbb{C}^{n_1,m_1}, B \in \mathbb{C}^{n_2,m_2}$ a naive way to computer the Kronecker product would be as such:
$M = \operatorname{zeros}(n_1n_2,m_1m_2)$ (initialize an empty array)
For $p = 1,2,\ldots n_1n_2:$
For $q = 1,2,\ldots m_1m_2:$
$M_{p,q} = A_{{\lfloor {{p}{n_1... |
Rice theorem says every non-trivial property of languages of Turing machines is undecidable. As David Richerby said in here :
Undecidable means not decidable. Undecidable problems may or may not be semi-decidable.
I would like to know how to find out Rice Theorem leads to semi-decidability or non-semi-decidability?... |
I would like to prove $\exists t\phi_t = \phi_{t^3+t+1}$ where $\phi_0,\phi_1,\phi_2,...$ are sequence of all of the partially computable function.
$\phi_t = \phi_{t^3+t+1}$ only if $t = t^3+t+1$ and it means $t=-1$! and there is no program with number $-1$!
|
Is it possible to insert a sequence of non-unique elements into an AVL tree?
For example, what is the AVL tree result of inserting 3, 3, and 3 into an initially empty AVL tree?
Is it:
3
/ \
3 3
|
I've reading up on Kosaraju's algorithm to compute the strongly connected components of a directed graph and I found that
using an adjacency list representation gives a time complexity of $\Theta(V+E)$.
using an adjacency matrix representation gives a time complexity of $O(V^{2})$.
Why $\Theta$ in the first case and ... |
I am confused about the definition of a strict transaction. What is the difference between a transaction that is strict and a transaction that is both strict and 2 phase?
|
If $A$ is turing recognizable and $A \leq_m\bar{A}$ then $A$ is recursive?
If it is true how to prove it?
Update
It is my attempt, If $A$ is turing recognizable (r.e.) and $\bar{A}$ is r.e. then $A$ is recursive. but by $A \leq_m\bar{A}$ I can't deduce that $\bar{A}$ is r.e.
|
I have a regular language consisting of such {0,1}^k sequences, in which every subsequence of length 5 has at least two 0's in it (which also means every sequence of length <5 is 'good'). I need to find a DFA which generates this language.
I can't say I tried everything, but each time I encountered the same problem, th... |
My gut tells me the time-complexity of the following code is simply O(n^2). However, I'm not convinced, thinking it could possibly be O(n^3):
cin >> n;
sum = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < n * n; j++)
sum++;
Can anyone provide a distinction, and why?
Thanks in advance.
|
How can we show that the class of regular languages is closed under the following operation?
Let $L_1$ and $L_2$ be laguages over $\Sigma=\{0, 1\}$.
The operation is: $$\{x \in L_1 \mid \text{ for some } y \in L_2, \text{ strings } x \text{ and } y \text{ contains equal numbers of } 1s \}$$
Is the only way to show t... |
I've researched several algorithms for determining whether a point lies in a convex hull, but I can't seem to find any algorithm which can do the trick in O(log n) time, nor can I come up with one myself. Let a[] be an array containing the vertices of the convex hull, can I preprocess this array in anyway, to make it p... |
I've been reading Linear Algebra and its Applications to help understand computer science material (mainly machine learning), but I'm concerned that a lot of the information isn't useful to CS. For example, knowing how to efficiently solve systems of linear equations doesn't seem very useful unless you're trying to pro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.