instruction stringlengths 35 29.1k |
|---|
$$L=\{0^n1^m | (n+m) \text{is even}\}$$
Using the pumping lemma ,
let me choose a valid string $W=0011$ $(n=2,m=2$ and $4$ is even$)$.
Let the number of states in the DFA ($C$) be $3$ (I find this step to be fishy)
$|W|\ge C$
Let $W=XYZ$
I choose $X=00,Y=1,Z=1$ such that $|xy| \le C ,|Y| \ge1$
So, for all $i$, $00(1)... |
Both $L_{REG}=\{ \langle M \rangle : L(M)\text{ is regular}\}$ and $L_{CFG}=\{ \langle M \rangle : L(M)\text{ is context-free}\}$ are $\le_m$-complete for $\Sigma_3^0$ in the arithmetic hierarchy. This of course implies that $L_{REG}\le_m L_{CFG}$. Can anyone come up with natural, intuitive, direct reduction?
[I can g... |
Please help me regarding following problem-
Let us consider Boruvka/Sollin's algorithm . Note that Boruvka/Sollin algorithm
selects several edges for inclusion in T at each stage. It terminates when only
one tree at the end of a stage or no edges to be selected.
Algorithm 1: One Step of Boruvka/Sollin's
Algorithm
1: Fi... |
I have the following problem.
I have a set of elements $x_0,\ldots,x_n$ which must retain their order inside the binary tree: if, given $x_i, x_j, i < j$, $x_i$ must be to the left of $x_j$ if $x_j$ is the root and $x_i$ is part of $x_j$'s subtree.
I also have a set of frequencies $f_0,\ldots,f_n$. I need to build ... |
Context-sensitive languages are exactly those that can be recognised using linearly bounded automata, i.e., those in NSPACE(O($n$)). This subsumes all languages that can be recognised in linear time, i.e., DTIME(O($n$)), since you can only use n memory cells in n steps.
However, this leaves open the possibility that so... |
We have a group of $n$ people. We are given a list of who must buy presents for whom within the group. Each person might need to buy/receive any number of presents, or possibly none at all. In a shopping trip, a subset of the people travel together to the same store, and buy presents for anyone who is not present at th... |
I am overviewing this expression given in set notation. Could someone translate what M "Element of" $\{{0,1}\}^k$ stands for? Im looking for an explanation in English like what I did below.
$K_e = \text{Encryption Key} $
$K_d = \text{Decryption Key}$
$\mathcal{E}_K(M)$ = Encryption using Key with Message M
$D_K(C)$ =... |
I've been struggling with solving the following question:
Supply an ADT that stores members (not necessarily unique) and supports the following functionalities:
1) MakeEmpty - creates an empty data structure - complexity in time Θ(1) worst case
2) Insert - inserts a member into the data structure - complexity Θ(1) in a... |
In O(n log k) time?
The input is the array of integers n, and some integer k. The output should be a boolean for whether or not the following condition holds for all elements: any two elements within k distance of this element cannot vary by a multiple of two (the maximum cannot be double the minimum).
The brute force... |
I have been reading up on the NeuronEvolution of Augmented Topologies and there's this little thing that's been bothering me. While reading Kenneth Stanley's Paper on NEAT I came on this figure here:
The innovation numbers go from 1,2,3,4,5,6 to 1,2,3,4,5,6,7 on the first mutation.
On the second one it goes from 1,2,3... |
Given a pseudo random number generator rand5() that generates a random integer in the set [0,1,2,3,4], how would someone use this to generate a function rand7() that outputs [0,1,2,3,4,5,6] with equal probability.
I was thinking of approaching it this way: reduce the problem to generate number from 0 to 6 using a coin.... |
I am new to machine learning. I am reading the book, where I have:
– Most general hypothesis
< ? ? ? ? ? ? >
– Most specific hypothesis
< Ø Ø Ø Ø Ø Ø >
in
Sky AirTemp Humid Wind Water Forecast
< Sunny ? ? Strong ? Same>
I understand that for a learning instance, "?" means it can take on any value, so the outcome of th... |
The prefixes of the string aabab are a, aa, aab, aaba, aabab.
If the number of a's should be greater or equal to the number of b's, the grammar would be
S -> aS | aSbS | e,
but I need it with strictly more a's than b's in any prefix.
I thought of this grammar, but I'm not sure it is correct.
S -> aS | aSAbA | a
A -> ... |
So I'm working on an implementation of a Wagner-Fischer-Algorithm for an online programming challenge site, but I can't seem to push the time down to where it needs to be. The assignment is to, for a number of different 'misspelled' words w1, w2, ... , wn and a dictionary D compute the editing distances between all wor... |
I want to show the following two propositions:
The domain of a recursive function is recursively enumerable.
The range of a recursive function is recursively enumerable.
I have thought the following in order to prove the first proposition.
Suppose that we have a recursive function $f$. Then we know that there is an a... |
I've been reading through the long division algorithm exposed in the Knuth book for a week and I still miss some details. There's an implementation of such algorithm in "Hacker's Delight" by Warren, however basically the author explains that it's a translation of the classic pencil and paper method and the Knuth book i... |
I have been reading this for quiet a long time that "RAM can be
accessed hundreds of times faster than a hard drive".
But, no one has been able to explain it properly.
I searched on Internet and found that "Access time of RAM is faster because they have less addresses(~4GB RAM) than Hard Drive(~1TB), and therefore ad... |
If we store a min heap of $n$ elements, $\color{Blue}{[1,2, \dots n]}$ into an array, then what can be minimum value present at any index $i$ and maximum value present at any index $i$. (elements are from $\color{Blue}1$ to $\color{Blue}n$)
|
A computational problem consists of a set of instances. In most cases the set of instances is infinite. Like the set of all graphs, e.g.:
Given a graph $G$, is there a Hamiltonian circuit in $G$?
Can the set of instances be finite and a problem still be non-trivial?
|
How do solve the following recurrence?
$$ T(n) = \frac{1}{2} T\left(\frac{n}{2}\right) + \frac{1}{n}. $$
Master's theorem cannot be applied as $a$ is equal to 0.5 which is less than 1. Hence the theorem fails. How do I solve a recurrence when the theorem fails?
|
Problem:
A number is said to be a magic number, if the sum of its digits, taken again and again till it becomes a single digit number, is 1.
Example: $289 => 19 => 10 => 1 => 289$ is a magic number
but, $20 => 2 =>$ not a magic number.
So the simple algorithm is to keep doing the digit sums till we reach a single... |
This question may be a little mathy or hardware-y, so I may have to ask elsewhere.
I've recently learned that if a is a positive rational number and b is a positive irrational number, there exists no common multiple between the two.
A common design consideration in threaded or embedded systems is concurrency control, w... |
Let be a language with the following alphabet : $\Sigma=\{a,b\}$
I want to write the regular expression of {$w$ | $w$ containing a number of $a$ that we can divide by $3$ }
A friend of mine thought of $(b^*+ab^*aa+aab^*a)^*$ and it seems alright for me but I said to me today that it wasn't true but I can't see why. I h... |
This question arose from a practical problem: given a set of texts, find one, which contains a given string (not word).
Let $S$ be a set of $n$ strings, and $l$ the length of the longest string in $S$. What will be the best data structure to efficiently search a string that contains a substring of length $k$ in $S$?
Se... |
When considering automata, they are normally considered over finite alphabets. The following are two types of automata that can handle words over infinite alphabets (definitions included for clarity).
The symbols $\triangleright$ and $\triangleleft$, appended to the beginning and end of the word respectively, are delim... |
I am trying to re-implement the model in this paper https://arxiv.org/pdf/1511.02917v2.pdf. But the paper omitted some details in feature extraction (Section 4.1). I am new to computer vision so I am confused when the paper just said they got the spatial feature (1440 dimensional) that corresponds to a 32*32 spatial hi... |
I'm writing a logic gate simulator. I would like to prevent user from constructing circuits prone to race condition such as flip-flops, and instead provide them as separate building blocks. Is that possible?
edit: I've got an idea. I guess that race conditions can only arise from logic circuit outputs directly or indir... |
Wiki gives two definitions for the NEXP complexity class:
$
\mathsf{NEXPTIME} = \bigcup_{k\in\mathbb{N}} \mathsf{NTIME}(2^{n^k})
$
where $\mathsf{NTIME}(f(n))$ is the set of decision problems that can be solved by a non-deterministic Turing machine which runs in time $O(f(n))$.
Using deterministic Turing machines ... |
Trying to find the right search terms for literature on classifying 2D time series data.
I am looking at data from positional tracking of a swarm of insects over time. I have example datasets for specific insect behaviors, and I would like to play around with training a classifier on these.
|
Suppose we have a complexity class $C$ (say for example $C = DTIME(2^{cn})$).
Take a language that belongs to $C$: $L \in C$.
Define an arbitrary polynomial reduction from language $L$ to $L'$.
To what complexity class does the result language $L'$ belong?
Thoughts: I think it might depend on the model of the compu... |
I'm having trouble with this homework question.
Prove if $f(n)$ is $o( g(n) )$ and $g(n)$ is $\Theta( h(n) )$, then $f(n)$ is $o(h(n))$.
I know I need to use the precise definition of a limit, but I'm not sure how to apply it to this proof. Any help would be appreciated.
|
In a comment on this question, @Kaveh wondered whether the questioner really wanted to ask "is there a relation between strings with high Kolmogorov complexity and pseudorandomness?" This is not the question that was answered, in the end, but I would like to know the answer.
I understand that any pseudorandom sequence ... |
This is a question from the book The Algorithm Design Manual by Steven Skiena, Page no- 201.
Articulation vertex : An articulation vertex of a graph (undirected) G is a vertex whose deletion disconnects G.
Given : Graph (undirected) $G = (V,E)$
Find : A vertex not an articulation vertex
Here is how i tried. I know a ... |
I am trying to understand Church's Numerals for 4:
$$4 = \lambda f.\, \lambda x.\, f f f f x\,.$$
This will be evaluated in the following order:
$$\lambda f.\, \lambda x.\, (f (f (f (f x) ) ) )\,.$$
My question is why the function body will not evaluate left outer most, like
$$( ( ( ( (f f) f) f) f) x)\,?$$
|
Given a regular language , how could we prove that it is alsways ( or can be always ) generated by clear grammar ( such as that for every sentence exists only one derivation tree ).
Could we prove it by creating minimalistic deterministic automata without epsilon transition ?
|
I was wondering if there is any technique in order to recognize similar functions behaviour. In particular, suppose that I implement two functions $f$ and $g$ in a certain programming language $P$ and for each input $i$, $f(i) = g(i)$. Moreover, the two functions $f$ and $g$ could be implemented in a completely differe... |
As we know, in IEEE 754 standard, float number's exponent and mantissa are stored differently. While the exponent is stored as an unsigned number, taking advantage of the bias, the mantissa is in sign-magnitude format.
The reason to use a bias seems to be the fact that another value of exponent can be achieved this way... |
Let's say $p_1, p_2, p_3, \ldots $ is the increasing sorted sequence of all prime numbers. Prove that there exists a constant $n_0 \in \mathbb{N}$, so that for all $n \ge n_0$:
$$K(p_n) < \log_2(p_n) − 2.$$
Hint: Prime number theorem: $p_n \in \Theta (n \ln n)$.
I think, I could have a program A, which generates... |
I came across a problem were you have to plan an optimal assignment pattern. Let's say you have $j=1,\ldots,n$ tasks during $i=1,\ldots,m$ time periods.
It's an single agent problem where we have to assign agent to perform exactly one task $j$ during each period $i$, i.e., $\sum_{j=1}^n x_{ij} = 1$ for $i=1,\ldots,m$ ... |
Is there any (kind of) (well-known) problem which can be expressed as a CSP in which the least constrained variable heuristic seems to give the best results, when employing backtracking with constraint propagation as the search method?
I am aware of the most constrained variable heuristic, and the intuition behind it, ... |
It is given $\mathcal O(n\log n)$ everywhere but in best case it should be $\mathcal O(n)$, isnt it ?
The argument here is, If my input has all the same keys, then every time I delete the root, I do not need to heapify, I just need to swap with the rightmost leaf.
Why is the above argument not valid ?
|
I have a system with three qubits as input and I want to demonstrate this equality:
where the left part of the equal is the circuit representation of the Toffoli gate where the first two lines are the control qubits and the third one is the target. On the right side we have the CNOT gate whose matrix representation is... |
I'm trying to think of corner-cases where I can skip having to linear-search through my dictionary in my problem; For a given word w1, find all matches with the least editing distance from it in the dictionary D (Levenshtein distance).
The dictionary can contain 500.000 words so a linear search through it can tend to ... |
We have to construct a DFA over the alphabet 0 and 1 for:
Every substring of four symbols has at most two 0's. For example, 001110 and 011001 are in the language, but 10010 is not since one of its substrings, 0010, contains three zeros.
I haven't reached to regular expression in the book which I am using. I am curren... |
The AND function in the lambda is:
and = (λ a. λ b. a b F)
I have following expression:
and T T
then the result will become T and I am asking me why?
When I do the beta reduction, then I understand, why I've got T:
(λ a . λ b . a b (λ x . λ y . y)) (λ x . λ y . x) (λ x . λ y . x)
(λ b . a b (λ x . λ y . y))[a →(λ x ... |
The activation of a perceptron style neuron is:
$DotProduct(Inputs, Weights)+Bias > 0$
That is essentially classifying what side of a (hyper)plane a point is on (positive or negative side), like the below:
$DotProduct(Point, Normal)+D > 0$
Looking at an N input, M layer perceptron network that has a single output can b... |
I'm teaching Architecture this semester, and I'm using Computer Organization and Design (Patterson & Hennessy) as the text. The book contains a table that has the typical access time and cost of SRAM, DRAM, flash, and hard disk as of 2012. Costs have come down pretty steeply in the last 4-5 years though, and I'd like t... |
Wikipedia has this about Pigeonhole sort:
Pigeonhole sorting is a sorting algorithm that is suitable for sorting lists of elements where the number of elements (n) and the length of the range of possible key values (N) are approximately the same.
I can see how it would be counterproductive to have more key values tha... |
A policy $P$ is defined as a set of parameters. We want to know the optimal policy $O$, which certainly exists but unfortunately unknown.
$D(P)$ shows how far $P$ is from $O$. The function $D$ itself is unfortunately not known. However, $D(P) - D(Q)$ is known. That is, one can always know which among $P$ and $Q$ is clo... |
I have an assignment where i have to encode certain problem to conjunctive normal form so i can solve it by using SAT solver. I have been able to encode my problem correctly but the solver is quite slow and most likely the cause for this is the length of some clauses which i have.
So my question is:
How can one break ... |
I have an array of elements $A = [x_0, x_1, \ldots, x_n]$, such that for some $0 \leq k \leq \frac{n}{2}$, there are $k$ 'bad' elements in $A$, but I don't know what indices they are at, or indeed, how many there are aside from the given bounds. I have a function which can, in $O(1)$ time, check if something is 'bad' o... |
I have a set of experiments with distributed environments.
I am planning to present a total network I/O bytes usage of the system for each run.
Which one should I report as total network I/O bytes among Sum(InBound Traffic) or Sum(InBound Traffic + OutBound Traffic)?
For example, say there are two machines A and B in ... |
In Khan Academy's RSA Encryption 2 video, I can't understand how they have got from
$$m^e\bmod N\equiv c$$
to
$$c^d\bmod N\equiv m\,.$$
The transcript says,
01:39 some piece of information that makes it
01:41 easy to reverse the encryption
01:44 we need to raise $c$ to some other exponent, say $d$,
01:48 which w... |
How can i remove from a red/black tree a subtree whose root and its sibling are red, and their parent is black, in $O(\lg n)$ time, while keeping the red/black properties at the end of the process?
In other words:
I have a black/red tree with $n$ nodes, a given black node $y$, and his two red children $x$ and $z$. How... |
I'm trying to wrap my head around the coin change problem, where you try to find the total number of ways $N$ cents can be exchanged using $M$ coins $\{C_1, C_2, ..., C_m\}$.
The recurrence relation is this:
I'm having difficulty understanding the 3rd line where it says solution[i][j-v[i-1]]. What exactly is this v th... |
Let f$(n)=O(n)$, $g(n)=\Omega(n)$ and $h(n)=\Theta(n)$.
Then $g(n)+f(n)\cdot h(n)$ is equal to what among $O(n)$,$\Omega(n)$ and $\Theta(n)$?
Also explain how to evaluate it.
|
Given an array with only 0 & 1. Can we have an algorithm which has all the following desirable characteristics-
The algorithm runs in $O(n)$ time.
The algorithm is stable.
The algorithm sorts in place.
I know the algorithms if only 2 characteristics are required but want to know if all the three characteristics po... |
Let $T_1(n) = O(f(n))$ and $T_2(n) = O(f(n))$.
Then $T_1(n) / T_2(n) = O(1)$ is a false statement. A counterexample is $T_1(n) = n^2$, $T_2(n) = n$, and $f(n) = n^2$.
I don't get this counterexample, if $T_2(n) = n$, then $T_2$ is $O(n)$ and not $O(n^2)$. (As indicated by $T_2 = O(f(n))$ and $f(n) = n^2)$. Therefore,... |
I have a function application:
E1 E2
Can someone please show me an example, how to execute function?
|
I can not see the difference between beta reduction and substitution.
For example:
(+ x 1) [x -> 2]
Here I can do the substitution, replace the variable x through 2(lambda expression) and result is:
(+ 2 1)
An example of beta reduction:
(λ x. + x 1) 2
the result would be
+ 2 1
For me, there are no difference betwe... |
There is a classic problem of finding the only number that occurs an odd number of times in a list. The solution is to xor everything and the result is the requested number.
The key properties used here are the involution of xor (i.e. a number's inverse is the same number) and the closure over integer range of the vari... |
I am trying to calculate the big theta of $ \lceil{log(n+1)}\rceil $.
I derived the following inequality:
$ log(n+1) \le \lceil{log(n+1)}\rceil \le log(n+1) + 1 $
Based on the definition of big theta, a function $ f(n) \in \Theta({g(n))} $ iff $ \exists \ c_1,\ c_2 > 0 $ and a constant $k $ such that $ \forall n \ge k... |
Assume we have a fixed number of $n$ one-dimensional affine functions of the form $f_i(x) = a_i x + b_i$ for $i \in N = \{1,\ldots,n\}$.
Consider some fixed value $k \in \{0,\ldots,n\}$. Let $S_k : \mathbb{R} \mapsto 2^N$ (power set) denote a function mapping some value $x \in \mathbb{R}$ to the set of indices of the $... |
Assume $u(n)$ calculates $n^2$ in $n$ steps, thus is in $O(n)$, and $v(n)$ calculates the square root of $n$ in $\sqrt n$ steps, thus is in $O(\sqrt n)$.
What is the runtime of the program u(v(n))?
The argumentation in my solution is:
"We calculate the square root first, then we take it's square. $\sqrt n + \sqrt n = 2... |
I'm considering the problem (a variant of 3-PARTITION, see here) with description
Instance: Set of positive integers $A={w_{1},...,w_{n}}$ with $S(A)=\sum\limits_{i=1}^{n}w_{i} = 3m$.
Question: Is there a partition of $A$ into 3 subsets $A=A_{1}\cup A_{2}\cup A_{3}$ such that $S(A_{1})=S(A_{2})=S(A_{3})$?
I plan... |
I am having trouble to get the intuition behind the following approach:
We take the fraction point (say: .642) and continuously multiply by 2,
taking whatever ends up right of the point as our next number (either 0 or 1) after the fixed point in the binary number. Then we take whatever is left after the decimal point a... |
We know that for general graphs vertex coloring problem/ minimum clique cover problem are NP-hard and for perfect graphs, they can be solved in polynomial time. There are classes of graphs which are perfect, e.g., bipartite graphs, chordal graphs, linear graphs, etc.
My question is that:
Are there any families of graph... |
There are Two Write Hit policies: Write Through and Write back
There are Two Write miss policies: Write Allocate and No Write
Allocate
There are two memory access techniques: simultaneous and
hierarchical access
Can any gentleman PLEASE write formulas for different combinations ?
I am having very importan... |
$$T(n) = T(\frac{n}{3}) + T(\frac{2n}{3}) + \sqrt n$$
Use the substitution method to prove $T(n) = O(n)$
What I have so far...
$T(n) \leq C_1n + C_2 \sqrt n-C_3 $
$T(n) \leq \frac{C_1n}{3} -C_3 + \frac{2C_1n}{3}+C_2 \frac{\sqrt {2n}}{3}-C_3 + \sqrt n$
I'm not really sure if I'm on the right track.
|
What does it mean when we say that an algorithm $X$ is asymptotically more efficient than $Y$ ?
$X$ will be a better choice for all inputs.
$X$ will be a better choice for all inputs except small inputs.
$X$ will be a better choice for all inputs except large inputs.
$Y$ will be a better choice for small inputs.
The... |
I have noticed this strange thing.All things related to Computers come in values which are powers of $2$.For eg. Rams come in $2,4,8$ or $16$ GB,pendrives and memory cards also come in similar values.Computers are $8,16$ or $32$ or $64$ bit values.
Everything remarkably a power of $2$.Why is everything $2^n$?
Why?Than... |
We know that $NTIME(t(n)) \subseteq DSPACE(t(n))$ and we know - by Savitch's theorem - that $NSPACE(s(n)) \subseteq DSPACE(s^2(n))$.
By the space/time relation $(s(n) \leq t(n))$ I know that $NTIME(t(n)) \subseteq NSPACE(t(n))$, then by Savitch's theorem $NSPACE(t(n)) \subseteq DSPACE(t^2(n))$ and not $DSPACE(t(n))$, a... |
My goal is to create a method that gets an array that only has 1's and 0's in it, and then turns every number into the amount of 'steps' it is away from the closest 0, left or right.
So for example [1] - [1] - [0] - [1] - [1] - [1] - [1] - [1] - [0] - [1] would be
[2] - [1] - [0] - [1] - [2] - [3] - [2] - [1] - [0] - ... |
I have been so confused for a while!! Please help me with this, thank you very much in advance!!
Given hypergraph $H = (V,E)$ consists of a set $V = \{v_1, v_2, \cdots, v_n\}$ of vertices and a set $E = \{e_1, e_2, \cdots , e_m\}$ of edges, each being a subset of $V$.
A subset $M \subseteq E$ is a matching if every p... |
Google is failing me, so here goes:
The data structure is used to describe a set of positive integers.
It works conceptually, by keeping track of disjoint ranges [a,b) on the number line.
These ranges are stored, in a sorted manner. For two consecutive ranges [a, b), [c, d) the invariant is that a < b < c < d.
The ran... |
Write-to-Read Relaxation means that for a processor:
later reads can bypass earlier writes
But what does that mean?
What exactly is the difference between a read and a write for a Cache?
An example we had in the lectures about Processor Consistency:
Isn't c2 also a write for w? How can it be before c1?
Why can CPU C... |
I am trying to understand what is MaxSNP-complete. I have read the wiki definition. I would like to get the intuition behind it. My knowledge of computational complexity is very basic.
|
I'm not an computer scientist, but still use/have an algorithm to find the $k$ nearest neighbours from a cloud of $N$ points in $d$ (my case $d=3$) dimensional space using some distance measure (in my case Euclidean). I had some look at the literature and it appears that the standard is J. H. Friedman, J. L. Bentley, a... |
If $L_1,\, L_2 \in RE / R$, must there exist a (computable) many-one reduction between them?
I can prove that for every two languages in $R$ exists a reduction between them. A possible reduction $L_3 \leq L_4$ where $L_3,\, L_4\in R$ goes as follows:
given an input $x$ to $L_3$, run $M_3$ (it's TM), if it accepted, ret... |
A hypergraph $H = (V,E)$ consists of a set $V = \{v_1, v_2, \cdots, v_n\}$ of vertices and a set $E = \{e_1, e_2, \cdots , e_m\}$ of edges, each being a subset of $V$.
A subset $M \subseteq E(H)$ is a matching if every pair of edges from $M$ has an empty intersection.
The dual $H^*$ of $H$ is a hypergraph whose vertic... |
I have been reading about how to test the undecidability of a problem, and some tests talk about the reduction technique. For what I could understand of this technique is that if I want to prove that problem X is undecidable I can take a problem Y which has already been proven to be undecidable. Then by using logic or ... |
Is there a DFA that accepts no string, but has at least one final state?
I think it would be possible to make a DFA that accepts no string only by creating no final states or by making sure that the final states are not accessible. But how can a state not be accessible if a DFA has all of its transitions defined?
|
I have to construct a pushdown automaton for the following language over alphabet {a,b,c}:
L={ ucv | |u|!=|v|; u,v={a,b}* }
(note: u,v are substrings over alphabet {a,b}, |u| is length of substring u)
My tutor has constructed a PDA using 4 states, however - I believe it's possible to construct this with only 3. Here's ... |
I am trying to interpret the following problem:
"Describe an algorithm for a Turing machine which receives the integer n as
input and proceeds to write the description of the n-th Turing machine from
the standard enumeration on its tape."
I am confused about how a Turing machine itself can represent another Turing mach... |
$T(n)=n\displaystyle \cdot T\left(\frac{n}{2}\right)+n^{\log_{2}n}$.
$f(n) = n^{\log_{2}n}$
Number of leaves = $n^{\log_{a}b} = n^{\log_{2}n}$
CASE 2 (All level same)
$f(n) = \Theta(n^{\log_{b}a} {\log^{k}n}) $
$f(n) = \Theta(n^{\log_{2}n} {\log^{0}n}), $ because $b = 2$, $a = n$, $k = 0$
Is $T(n) = \Theta(n^{\log_{2}n... |
If there are given two arrays, A and B, each containing n real numbers in sorted order. How to compute the median of all the numbers in A and B, in O(log n) time. I have to make an algorithm that takes at most logarithmic time.
My idea:
A = 1, 3, 6, 8, 10, 15, 20
B = 1, 2, 3, 7, 10, 30
C = sort(A, B)
a = len(A) // 7... |
Let us define a Turing machine by a machine description that is a string of symbols produced by some numerical encoding. For example, a Turing machine $M_1$ can be represented by 9,900,599 ([0 0 halt], where halt = 5 and the start and end of an instruction is 99). A standard enumeration consists of all possible Turing ... |
I have some questions regarding the emptiness problem of Turing machines when we have a TM which accepts empty language, and we have to make sure that the TM does not accept any string. My questions are:
in formal description of TM I have read that input alphabet can't be
empty then how a machine can accept empty inpu... |
Good day.
Consider N points forming a circle (N is even and is between 1 and 200).
The task is to calculate the minimum cost of linking all 2 points (as pairs) without any lines intersecting.
Each point is given an ID. The cost to link 2 points a and b is (id(a)+id(b))²
Please note: a point can't be part of 2 pairs.
Ex... |
Suppose I have distinct letters in an alphabet $\sum = \{a_1,a_2,...,a_n\}$. I also have two permutations of these letters, let's call them $A,B$. How can I find the Edit distance between $A$ and $B$ with block edit operations allowed?
To make it clearer, an example would be $\sum =\{a,b,c,d \}$. Two possible permutati... |
Let's say that I define the language $L$ over the alphabet $\{0, 1\}$ to be a language containing only one word, $w$, where:
$$ w =
\begin{cases}
1 & \text{if the continuum hypothesis is true}\\
0 & \text{otherwise.}
\end{cases}
$$
$L$ is finite, therefore there is a Turing Machine which can decide whe... |
The definition of NP-hard problem in Wikipedia is :
NP-hardness (non-deterministic polynomial-time hard), in computational complexity theory, is a class of problems that are, informally, "at least as hard as the hardest problems in NP".
There are NP-hard problems not in NP class. My question (more curiosity) concerns t... |
I am implementing a couple of PSO (particle swarm optimization) algorithms, and I got stuck on a bit of detail which I could not clearly determine from the papers I have read. In lbest PSO, for each particle, the velocity update step takes the best particle's position in that particle's neighbourhood into account. What... |
I am trying to build a tool for solving TSP problem using a conversion to SAT.
Does there exist an efficient conversion from the Travelling Salesman Problem to the Satisfiability problem? Since they both are NP-Complete it seems like the answer might be yes. I just need a conversion that is tractable in practice. Th... |
The log rank conjecture states that there is some universal constant $c > 0$ so that
$$CC(f) = O(\log^c \text{rk}\,(M_f))$$
where $f : X \times Y \to \{0, 1\}$ is a boolean function, $CC$ denotes the deterministic communication complexity, $M_f$ is the $|X| \times |Y|$ binary matrix associated to $f$, and $\text{rk}\,(... |
I would like to work on urbanisation and I've read that cellular automata has potential use on model urban sprawl. However I need some kind of introductory to cellular automata in order to tackle an academic paper I have found.
I have a fair background in Computer Science. Moreover I am looking for any tools from CS ap... |
I am learning about Hashing and have struggles with the following assignment:
$U$ is a universe of keys with $Z(m)=\{0,\ldots, m-1 \}$ the amount of possible hash-values.
Given $U= \mathbb{Z}_{55} = \{0, \ldots, 54 \}$ and $m=5$.
Does the function $h(k,i)= (k+i) \bmod{5}$ fulfill the conditions for Uniform Hashing?
... |
For $k = 0,\ldots, K - 1$, $M_k$ is a subset of $\{0, \ldots, N - 1\}$, and the subsets $M_k$ are not necessarily disjoint. I want to find a permutation on $\{0, \ldots, N - 1\}$ such that the range of values of each subset is as small as possible after permuting everything. Formally speaking, let $\sigma(M) = \{\sigma... |
Let be $G=(V,E)$ a directed graph without self loops, where each node has an out-degree of at least $k$.
We want to find a $E'\subset E$, so that $G'=(V,E')$ has the following properties:
Almost all nodes in $G'$ have an out-degree of: $l \le k$
$G'$ has the highest possible diameter
The almost all nodes part is to ... |
Does this problem have a solution with $o(n^2)$ time complexity? If so, what would be an example of such a solution?
Given $N$ integers in the range $[−50\ 000,\ 50\ 000]$, how many
ways are there to pick three integers $a_i$, $a_j$, $a_k$, such that $i$,
$j$, $k$ are pairwise distinct and $a_i + a_j = a_k$? Two ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.