instruction stringlengths 35 29.1k |
|---|
There exist various Turing-equivalent models of computation, such as lambda calculus, Turing machines, or register machines.
It seems that dependent type systems (like Coq, Agda, Idris, homotopy type theory) all have a lambda-calculus-based model of computation at their core. That's because they use term substitution (... |
Use the DFS and BFS algorithms to solve the Towers of Hanoi problem. Which performs better and why?
Towers of Hanoi
Towers of Hanoi visualization
When I think of the Towers of Hanoi problem, I think of moving the three disks in a LIFO order. The last disk you place on a rod must be the first one to move off the rod. ... |
from my understanding the truth table is supposed to generate every possible combination of true and false values without the order of the combination taking into account.
however one of my teachers said that their is a particular order to each row that is used to generate multiple combinations.
can you please explain... |
This is a possible duplicate of the following (but not sure it answered my question):
Is it possible to support .(any symbol) or \d, \w, \W in DFA
My professor is asking for a finite automata state diagram for some language that accepts even length strings (actually it's more complicated than that, but I'm starting wit... |
first of all I'm sorry for my bad English and second I'm sorry for my mistakes of understanding the following topic, I still going to school and learning this for interest.
The topic is Myhill-Nerode and the equivalence classes of a regular or non regular language.
I know that every element of a equivalence class by My... |
Lamport's distributed mutual exclusion algorithm (also described here) solves mutual exclusion problem for $N$ processes with $3(N-1)$ messages per request ("take and release lock" cycle).
It requires that for each pair of processes $P$ and $Q$ all messages send by $P$ to $Q$ are received and processed by $Q$ in the sa... |
Given a set of numbers $D$ and some number $k$ I want to find all numbers that are in $D$ such that the distance between $k$ and any found number is less or equal to integer $n$?
Example: suppose we have $D=\{5,9,0,6,7\}$ and $k=8$ and $n=1$ then the result should be $\{9,7\}$.
I was thinking to use a k-d tree or VP tr... |
Suppose that L0, L1, L2 are languages over the same alphabet and that
L0 ⊆ L1 ⊆ L2.
Is it true that if L0 and L2 are regular, then L1 must be regular as well?
By regular = the set of words accepted by a finite automaton.
Suppose
L0 = { $a^{\textrm{n}}$ | n = 2}
L2 = { $a^{\textrm{n}}$ | n => 0}
how can i find a se... |
I have the set:
B = {x ∈ {0,1}* | there is an equal number of 0's and 1's in x}
and therefore,
B* = {e,01,10,0011,0101,0110,1100,1010,1001,....etc}
I need to either prove or disprove that B*=B
I believe they are equal, because B* is just the concatenation of one string onto another. I think the trick is since the 0's a... |
I have a problem where given an infinite binary sequence S ∈ {0, 1}∞ to be "prefix-repetitive" if there are infinitely many strings w ∈ {0, 1}*
such that ww is a prefix of S.
I need to prove that if the bits of a sequence S ∈ {0, 1}∞ are chosen by independent tosses of a fair coin, then
Prob[S is prefix-repetitive] = ... |
I don't understand why O notation is the worst case. If this notations describes a function f such that 0 <= f(n) <= cg(n), we can see that in any case f will be smaller that the original function g that describes the running time. In my idea, f(n) describes a better option because the running time is less for any inpu... |
I understand how the recurrence relation of quicksort is
$T(n) = 2T(n/2)+\mathcal{O}(n)$,
but if we are guaranteed a certain pivot, for example $n/4$th smallest element to be the pivot every time, how would it affect the recurrence relation? I would love some insight on how to approach analyzing such performance.
|
If a given heap has $k$ inversions, what is the complexity of making it into a valid min heap? We could define an inversion as a tuple (node, descendant), where the node has a key value strictly higher than its descendant (all nodes have distinct key values).
This isn't an interview question, but is something that I th... |
I am having a hard time understanding homomorphism. All I seem to understand is that it is a substitution. When I look at examples of proving closure of a particular operation over a regular language, I don't understand how people come up with the substitution strings that they choose, and how they use them to produce ... |
I have used programming languages which generate a random number in a given range.
Let's say we have a range of 1 to 10 each number has the probability of 1/10 to get selected. What is the criteria on the basis of which a random number is selected with uniform probability by a programming language.
|
I'm an entire outsider to computer science eventhough I've been programming for so many years.
As we know, modern audio-visual media codecs are essentially entropy codings of subjective preceptual information. Well known codecs such as AVC, HEVC, AAC, AC3 are highly efficient at compressing AV data.
So I wonder, what... |
For the problem of a subsequence of maximum product with negative, zero and positive integers, I have the following working solution (inspiration from here).
Let us first show how to solve the problem when the array contains no zeroes:
If there is a single entry, return the entry.
If the number of negative entries is ... |
If a hash table is using open addressing as the collision resolution strategy, then during deletion, we mark that slot as dummy.
I understand the reason behind that is because while probing, a dummy would indicate there are still used slots further down the chain to search for.
But my question is that is there any way... |
Is there any possible general algorithm for constructing a DFA such that it accepts any string, which has a given sub-string in the suffix(end) for any given language. The algorithm should directly construct the DFA transitions, and not create an NFA first and then convert it to a DFA. In other words, the algorithm acc... |
Typically, add/subtract/multiply/divide are primitive operations in an Instruction Set Architecture (ISA). I am interested to know if they can instead be implemented efficiently using only bitshift operators. I'm interested to know what sequence of bitshift operations can reproduce the addition operation.
|
I want to ask that between turing machine and pushdown automaton: which abstract machine can handle context-free language (CFL) in a more efficient way, and why?
I know that a pushdown automaton can use exactly one step per input symbol, which is a tight lower bound on efficiency. (If we’re measuring in number of steps... |
So you can have One Instruction Set Computers. But typically these instructions have rather complicated underlying implementations.
addition (addleq, add and branch if less than or equal to zero)
decrement (DJN, decrement and branch (jump) if nonzero)
increment (P1eq, plus 1 and branch if equal to another value)
subtr... |
Background
I'm looking at Transport Triggered Architectures (also this), linked to from an OISC page listing many different 1-Instruction Set Computers. It basically says the following:
TTA programs do not define the operations, but only the data transports needed to write and read the operand values. Operation itself... |
I want to generate pseudo-random hashes of inputs in a way that is optimally time and space efficient.
I'm not at all concerned about security. The output should be evenly distributed and appear random in relation to the input, but it doesn't matter if it's possible - even trivially possible - to determine the input t... |
A(B ∩ C) = { UV | U ∈ A, V ∈ B and V ∈ C } for the left part.
ΑΒ = { UV | U ∈ A, V ∈ B },
ΑC = { UV | U ∈ A, V ∈ c },
AB ∩ AC = { UV | U ∈ AB and AC, V ∈ AB and AC } for the right part.
How can I continue further into the proof?
|
At work I stumbled across this problem of allocating resources:
We are given a set of objects belonging to one of seven possible classes (multiple objects per class are allowed). We distinguish between classes A, B, ... G, because they have 3 possible attributes (weight, interest, size).
We also have four boxes X, Y, W... |
I'm learning about monads, I understood why they are useful, I understood in general what bind, join, return do.
I also looked at basic usage examples for the basic reader / writer / state / list / maybe monads.
Still, being a beginner, I still don't feel I have a grip on what the "run" function means in general. It do... |
We can compute the binary representation of $n$ and similarly by decrementing the value of $n$ by $1$ each time we can get all values from $2$ to $n$. We can now use a Turing Machine that multiplies binary numbers to get the value of $n$. But will this computation be bounded by $O(n)$? That is, can $n!$ be a time const... |
In "Computational Complexity" textbook by C. H. Papadimitriou, p. 141, he proved the following claim.
Proposition 7.1: Let there be a DTM/NDTM M that decides a language L within time/space $f(n)$, where $f$ is a proper function. Then there is a precise TM $M'$ that decides L in time/space $O(f(n))$.
Proof. We start s... |
I'm starting to dabble in language theory, regular expression & infinite words.
I'm not quite sure I completely get the meaning of this expression:
$(a + b)^\omega$
$^w$ meaning infinite repetition, I'm not positive it's standard syntaxe or just our class.
My main question is - do I have to "settle" on either a or b a... |
I'm trying to exhibit two formal languages $A,B ⊆ \{0,1\}^*$ such that $A^* = B^*$ and $\{0,1\}$ is contained in $A$ but not in $B$.
Finding a language for $A$ is very easy, but I get stuck on $B$, because since $A^*=B^*$, and A has $\{0,1\}$, that $B^*$ must also have $\{0,1\}$. I can't think of a language that has $\... |
I am still trying to wrap my head around this, which shows how to simulate control-flow without using an if-statement.
I've been looking at basic logic today and learned that you can represent all logic with 1 (like NAND), 2 (AND + NOT, OR + NOT, etc.), or 3 logical primitives.
This makes me wonder if you can represent... |
I am confused regarding the absorption rule which states: A OR (A AND B) = A.
I do not completely understand how the expression simplifies to A and while i have seen proofs for this question, i still feel that i don't completely grasp it.
I will outline my working out below:
if expression = A OR (A AND B) then, accordi... |
First, consider $$L_\exists=\{\langle M\rangle \mid M \text{ is a Turing machine and accepts some input}\}$$
is RE. I tried to construct a Turing machine:
Input: Code(M);
L_e_TM(Code(M))
for all words w of binary strings
simulate M on w,
if M accept w then return true;
end for
end
Since we... |
I have a priority queue implementation which I claim has the following worst case asymptotic run-times for the given operations:
PEEK_MIN …………………………… O(1)
POP_MIN…………………………… O( (INVERSE_Γ(n)) ^2).
INSERT_XKEY…………………………… O( (INVERSE_Γ(n)) ^2).
DELETE_IKEY…………………………… O( (INVERSE_Γ(n)) ^2).
n denotes the number of eleme... |
I am searching the web for an answer to this question, but I have only found answers for non-distributed algorithms. I am interested in this for its application to Distance Vector routing.
|
Credit to KleinBerg and Taros Book
Some of your friends have gotten into the burgeoning field of time-series data mining, in which one looks for patterns in sequences of events that occur over time. Purchases at stock exchanges—what’s being bought— are one source of data with a natural ordering in time. Given a long se... |
Can someone provide a brute force pseudocode for finding best connections between odd-degree nodes in the Chinese postman problem mentioned here?
For example, if the odd nodes are $B,C,D,E$, the program should output the three pairings
BC,DE; BD,CE; BE,CD.
|
We are given $n$ tasks and $m$ resources. Each task $i$ requires a set $S_i$ of resources to be active, and each resource can be used by at most one task. The Resource Allocation problem asks: given $S_1, \ldots, S_n$, and an integer $k$, whether it is possible to allocate the resources to the tasks so that at least $... |
Normally, to find the rule that is suitable to our need, we have to generate all possible rules and apply each rule on a seed and check whether a rule produces a desired pattern. This method is exhaustive and computationaly intensive.
Is there a way to derive the rule that would generate the desired pattern?
|
R-complete, i.e. it is an analogue to all recursive language can be reduced to that problem and also recursive? Or is there a really such definition?
RE-complete is described on wikipedia. But what kind of reductions is used? Since we are already out of the set R, does it still make sense to define by many-one reductio... |
If it is possible to construct an SLR parse table with no conflicts for a particular grammar does that mean that the grammar is unambiguous?
I think that since we have constructed the parse table which means for every sentence we would be able to decide whether the string will be accepted or not. But I am a little bit... |
As I understand it the Quine-McCluskey method allows you to start with a set of maxterms (or minterms), and combine them pairwise in a systematic way into a smaller set of clauses with a smaller set of variables in some (hopefully most) of the clauses. I understand how to apply the method, given a set of maxterms.
My... |
I will briefly state the context where my doubts arise.
I know the following definitions.
A formal language is a set of well-formed formulas. It's a tuple constituited by an alphabet and a formal grammar.
An alphabet of a formal language is a set of symbols. It's usually consituited by letters (symbols whose inter... |
I have the following problem:
There are existing stars (as in graph-theory stars) with a fixed representation in a 2D coordinate space, meaning that angles between the edges are not allowed to change.
Now I want to add additional edges from the star center. Both the amount of existing edges and the amount of edges to a... |
I don't know why case 4 will resolve the issue of the double black of $x$ described in Introduction to algorithm p.329. I know case 1 is transformed into one of {2,3,4} case, and case 2 re-point $x$ to its parent node so it's approaching the root, and case 3 will be transformed into case 4, but both case {3,4} will not... |
Suppose you and your $k - 1$ housemates decide to throw a party. Each housemate $i$ gives you a list $P_i$ of people she would like to have invited to the party. Depending on how much you like housemate $i$, you pick an integer $m_i$ indicating the minimum number of people on $i$'s list that you'll invite. Having sel... |
Is it not always possible to represent a Finite State Machine (FSM) by a Boolean dynamical system?
A Boolean dynamical system is defined by a Boolean map $F\colon B_{0}^n\to B_{0}^n$ (where $B_{0}$ is the-two element Boolean algebra $\{0,1\}$ with operations of $\lor$ (OR), $\land$ (AND) and $\neg$ (NOT)) as
$$x(k+1)=F... |
I have a question to the reduction from Vertex Cover into Dominating Set.
So my lecture says if I have a undirected Graph $G = (V,E)$ where $S \subseteq V$ is a vertex cover. Then we construct a new graph $G'$ which has the same vertices of G, except the isolated ones. For each edge $\{u,v\}$ in $G$, we add a new verte... |
Summary:
I am struggling with the Pseudo code for an that algorithm assigns "least filled slot first" to a tasks on multi-core chip.
Detail
So far I have written following:
What I do not like here is:
In while loop I am removing one by one elements of $R$ (which is a row vector with $m$ elements). This means the co... |
The successive shortest path algorithm, used to solve the minimum-cost flow problem, can be described as follows :
Successive shortest path (for minimum-cost flow) :
while all flow is not sent :
compute shortest path between source and sink nodes w.r.t. arc costs (through Dijkstra's algorithm for example).
augment t... |
Suppose i have some NPDA and there is some transition functions defined as:
$\delta(q_{1},a,A) = (q_{2}, A)$
$\delta(q_{1},a,A) = (q_{3}, Z)$
Is it allowed?
I understand, that since the NPDA is nondetermenistic, it's possible to have transitions to different states with the same input character, but what about same ele... |
Let's say I want to set x1=1 if (x2=1 AND x3=1 AND x4=1) or (x5=1 and x6=1) or (x7=1) else x1=0
All of the xs are binary variables.
My first thought is I have to add 3 additional variables, let's say y1, y2, y3 and 12 constraints like this
3*y1-x2-x3-x4<=0
y1-x2>=0
y1-x3>=0
y1-x4>=0
2*y2-x5-x6<=0
y2-x5>=0
y2-x6>=0
y3-... |
I am working on an implementation of inverse kinematics using the jacobian transpose method. The implementation seems to be working as it does find the "theta" vector, although sometimes it might take an insane amount of steps to do so, which makes me believe that it is not correctly implemented.
So after reading a bit... |
Master's Theorem is known to me, but I can't understand how to apply this theorem to this problem.
So, how I will find Θ of T(n)?
|
I mean that for every $i$ from 2 to $\lceil \log_2n\rceil$ I want to know $\lfloor \sqrt[i]{n}\rfloor$. Could this be done faster than computing the roots one by one?
|
I am new in algorithm and studied about some problems in algorithm related to graph theory. These problems we can transform to some polynomials and if for each set of polynomials related to a problem we have a solution then it means the problem has a question. For example we can transform the problem of MAx-Clique to t... |
Given to us is an array $B[1],\ldots,B[n]$ as input, which satisfies the following property: there exists a special index $i^* ∈ \{1, \dots , n\}$ such that $$B[1] < B[2] < \dots < B[i^*− 1] < B[i^*] > B[i^* + 1] > B[i^* + 2] > \dots > B[n].$$
It is noted that the index $i^*$ is not given as part of the input.
The ques... |
I want to train a Perceptron using stochastic gradient rulefrom the stream data. I have very limited amount of memory and i can store only $N$ examples.
Suppose my population consist of point as show in the following picture:
Now suppose my first $N$ examples come in following fashion and i can classify them correctl... |
I have a question regarding performance of 2-opt and 3-opt algorithms.
I tried implementing the 3-opt and 2-opt algorithms and most of the time 3-opt outperforms the 2-opt algorithm around 5%.
Surprisingly, in few cases my 2-opt algorithm outperforms the 3-opt algorithm. I am wondering, is it some kind of error or it ... |
I have a chain graph like in the picture. Each node of the graph has finite possible labels, i.e. states, which define the node's weight(non-negative) as well as the internode weight(also non-negative). Each node is connected to m previous ones. The internode weight is shown as edge and node weight as node itself. Is t... |
Given two CFGs for balanced parentheses.
$S \rightarrow SS \mid (S) \mid \epsilon$
$S \rightarrow S(S)S \mid \epsilon$
How do I show that they are equivalent?
I have been able to show $ L(2) \subset L(1) $ as follows
$$ S \Rightarrow SS \Rightarrow SSSS \leadsto S(S)S $$
Thus, $ S \leadsto S(S)S $. Keeping productio... |
Note: this question has been cross-posted to Math.SE, after about a week here.
I am trying to deepen my understanding of the relationship between the Halting Problem and Godel's Completeness Theorem (not Incompleteness).
Specifically, as I understand it the Completeness Theorem guarantees a finite proof for any first-... |
I'm a university student currently taking an Assembly and Computer Organization class. On last weeks lab we were given a question:
Suppose that you buy a 32bit PC with 16 MB of Ram. What is the 8-hex-digit address of the last byte of installed memory?
From my understanding you multiply MB (2^20) with 16 (2^4) which giv... |
The following question on the theory of computation is GATE 2019 CS question 24:
For $Σ = \{a, b\}$, let us consider the regular language: $$L = \{x \mid
x = a^{2+3k} \text{ or } x = b^{10+12k}, k \geq 0\}$$ Which one of the
following can be a pumping length (the constant guaranteed by the
pumping lemma) for $L$?
(A... |
I'm doing a problem where I need to prove that there is a language A ⊆ {0, 1}* with both of the following properties:
(i) For all x ∈ A, |x| ≤ 5.
(ii) Every DFA that decides A has more than 8 states.
To prove this, is it suffice enough to just give an example language A ⊆ {0, 1}* that holds both of these properties?
|
There's a problem in Kleinberg & Tardos's Algorithm Design (Chapter 6, Question 4) where you are running a lightweight consulting business that has two offices: NYC and SF. In month $i$, you'll incur an operating cost of $N(i)$ if you run the business out of NY; you'll incur an operating cost of $S(i)$ if you run the b... |
I'm practicing a problem where I need to prove that every full prefix-free language is maximal.
I know a prefix-free language A is maximal if it is not a proper subset of any prefix-free language, where a prefix-free language is full if,
$$\sum_{x\in A} 2^{-|x|} = 1$$
Furthermore, I know that a language A ⊆ {0, 1}* is... |
I want to iterate through the first $k$ elements of a randomly ordered list containing all subtrees for a given tree. The definition of subtrees that I'm using is: "A subtree of $T$ is a subgraph of $T$ that is also a tree". For example, a tree $A(B(D, E, F), C(G, H))$ should have 62 subtrees if my math is correct.
The... |
I am a student who is studying machine running alone.
As far as I know, the Tf-idf Vectorizer is a function that combines the Count Vectorizer and the Tf-idf Transformer.
I was wondering if the Tf-idf Transformer process could actually have a impact on the model learning process.
In my experience, there seemed to be no... |
Given a directed graph $D = (V,A)$ with edge-weights $w\in\mathbb{R}_{++}^A$ I'm trying to construct the following graph $D'=(V',A')$:
For a fixed $v\in V$ we add a vertex $(v,0)$ to $V'$
For every $(z,i)\in V'$ and $zu\in A'$ we add the vertex $(u,i+w_{zu})$ and the arc $(z,i)\to(u,i+w_{zu})$
In each path of $D'$ the... |
I am having a hard time even to formulate my question, so here it is:
I have an application that the user can go in and define on a webpage the logic one wants to evaluate for the student to comply with:
Student must take classes (MATH111 OR (MATH101 AND MATH103))
I have an array of all its enrolled classes like:
[... |
In a bipartite graph $G = (V,E)$, there is a neat algorithm for finding a maximum matching (or even a maximum-weight matching) using linear programming. It is explained here. The first step is to solve the following LP:
$$
\text{maximize}~~\sum_{e\in E} w_e x_e
\\
\text{subject to}~~\sum_{e\in E: v\in e}x_e=1\text{ for... |
Question 1
Consider a repetition code to detect $m$ errors. What is the smallest repetition parameter $k$ (i.e., the number of repetitions per bit) it should be used so that the code can always detect $m$ errors?
To be clear I know that you need $k=2m+1$ to correct errors, I am asking what is $k$ if you only want to de... |
I was going through Count All Palindromic Subsequence in a given String where I've to count all the palindromic subsequence of a given string.
After seeing the brute force(recursive solution), I went through the dynamic programming technique but the index values used surprised me.
for (int L=2; L<=N; L++)
{
for (... |
In Elements of the Theory of Computation by Lewis and Papadimitriou, the authors use a specific function for proving that application of unbounded minimization on a primitive recursive function need not be regular.
They choose a peculiar function to prove so, defined as follows.
Let $M=\{K,\Sigma,\Delta,s\}$ be a Turin... |
I want to define the language of this FSA with a regular expression. I have learned that by state-elimination, I would be able to find a regular expression.
But there are already some epsilon transitions in this FSA.
My question is:
Should I first follow the epsilon-removal construction, and then do state elimination?
... |
I recently wrote my Grad school Admission test few days back and the following question appeared in the test.
There are 'n' unsorted Arrays : A1, A2, ...., An. Assume that 'n' is odd. Each of A1, A2, ..., An contains 'n' distinct elements. There are no common elements between any two arrays. The worst case time complex... |
I am reading Introduction to Algorithm CLRS (3rd ed.), Chapter 4 (Divide and Conquer), page 78, and am not sure why the explanation of why SQUARE-MATRIX-RECURSIVE algorithm takes $Θ(n^3)$.
Combining equations (4.15) and (4.16) gives us the recurrence for the running time of SQUARE-MATRIX-MULTIPLY-RECURSIVE:
$$
T(n) ... |
The theorem states that
$$
H(P)\leq\mathrm{MinACL}(P)<H(P)+1
$$
where, $\mathrm{MinACL}$ means the minimum average code word length of a given information source, i.e. the average code word length of any Huffman coding and $H$ means the entropy of the probability distribution $P$.
Now, the problem is how to show that f... |
$ L = \{ww^{R} \in \{a,b,c\}^{*} : |w|_{a} \not\equiv |w|_{b} $ and $ |w|_{b} \not\equiv |w|_{c} \} $
I would use the Ogden pumping lemma. Assumption $n < m$ where $n$ is a number from lemma. My selected word : $ a ^ {m! + m} c ^ {m! + m} b ^ {m} b ^ {m} c ^ {m! + m} a ^ {m! + m} $ where the first $ b ^ {m} $ are the... |
How would one find a minimum-weight perfect 2-matching of a general graph? Is it possible to use standard matching techniques like Blossom V?
A minimum-weight perfect 2-matching of a graph G is a subgraph M of minimal total edge weight, such that each vertex in G is incident by exactly 2 edges from M.
|
To find the meaning of computer architecture terms in Computer Science do I need to use a Computer Science book? Do I need to find the computer architecture terms in a Computer Science Dictionary or is there a another way of finding the computer architecture terms? If there is another way to find the terms please can y... |
It is known that every program or every algorithm can be converted to Turing machine. But what about the reverse process? Is there algorithm (or research trend that considers such algorithm) to convert some Turing machine into algorithm as expressed in some high level programming language (e.g. in Algol, Java, Prolog, ... |
How would one find a minimum-weight perfect b-matching of a general graph, where the number of edges incident on each vertex is a positive even number not greater than b?
A minimum-weight perfect b-matching of a graph G is a subgraph M of minimal total edge weight, such that each vertex in G is incident by exactly b ed... |
I'm struggling to think of such a network. According to the definition I'm working with:
Given a network $(V, A, w)$.
For all arcs $(u, v) \in A$ :
$\quad$ If $d[u, |V| - 1] + w(u, v) < d[v, |V| - 1]$:
$\quad\quad$ Print “Negative cycle!” and stop immediately
To me this implies the only way a negative cycle isn't det... |
According to this link:
We need the notation for the lower bound. A capital omega $\Omega$ notation is used in this case.
We say that $f(n) = \Omega(g(n))$ when there exist constant $c$ that $f(n) \geq c \cdot g(n)$ for for all sufficiently large $n$. Examples:
$n = \Omega(1)$
$n^2 = \Omega(n)$
$n^2 = \Omega(n \cdot ... |
Can't find a good way to tackle the problem. Would appreciate any help.
$A$ is an $n$ items array from an ordered set, in which every item is at most
$\log n $ indices away from its position in the sorted array.
Show that:
The array can be sorted in $O(n\log\log n)$.
There is a lower bound of $\Omega(n\log\log n)$ f... |
$ L = \{w \in\{a,b\}^{*} : \exists_{x,y,z} , w=xyyz \wedge y \neq \epsilon \}$
I have a problem with this exercise. I need to determine if this language is regular, context-free or not both and prove. The word itself $ww$ above the alphabet $a, b$ is not context-free, but here we have $(a + b) ^ {*}$ before and af... |
I was wondering about the following interesting questions:
Polynomial multiplication can be done in $O(nlog(n))$ using FFT where n is the degree of the polynomial.
What about finding a specific coefficient (or even deciding whether it is 0 or not) of some degree $k$ of the multiplication of an input? It is trivial to s... |
Consider this example on binary trees in some ML-like language:
type tree =
| Null
| Node of tree * tree
let rotate_left p =
match p with
| Null -> p
| Node (a, q) ->
match q with
| Null -> p
| Node (b, c) ->
Node (Node (a, b), c)
In the definition of rotate_left above I only want to consi... |
$ L = \{ww^{R} \in \{a, b\}^{*} : |w|_{a} \equiv |w|_{b} \equiv 0$ $ (mod$ $13) \} $
Exercises: If the language L is regular (build a DFA or regular expression)
else if the language L is context-free (build a grammar or PDA)
else if the language L is not context-free (Prove)
so
We know that $ww ^ {R}$ without any re... |
I am learning Big O and Big theta notation and confused the certain case.
I have two functions,
function 1(f1)
$$ n * n^{1/2} $$
function 2(f2)
$$ 1.001^n $$
in smaller cases (10,000) f1 is much faster than f2, however, it is vice versa for bigger case (10,000,000). For the smaller case, I can say
$$ f2 = O(f1) $$
In t... |
You are given a 2d grid where each grid item has a value of 1 or 0, you can only move horizontally or vertically and if both blocks have value of 1. You are also given a starting index, the output should have the "connected" grid items property to true.
For example:
input = [
[{value: 0}, {value: 1}, {value: 1}],
[... |
If $L\subseteq\Sigma^*$ is a regular language, then $\text{mir}(L) = \{ww^R \mid w\in L\}$ is context-free. This is a nice exercise.
Question: does the reverse hold? Thus, if $\text{mir}(L)$ is context-free, do we always have $L$ is regular?
|
I'm having trouble making an algorithm to fit these specs:
Given a complete binary tree ($n = 2^d$ leaves) with integers in leaves.
Reading the leaves from left to right makes a sequence of integers (we can assume we have an array)
Goal: How can we minimize the number of inversions in that array only by choosing non-... |
$L = \{ w : |w|_{a} \equiv |w|_{b} \vee |w|_{c} \equiv |w|_{d} \}$
In my opinion complement of the L language is
$L^{C} = \{ w : |w|_{a} \neq |w|_{b} \wedge |w|_{c} \neq |w|_{d} \}$
I choose to Ogden pummping lemma word $s = a^{p}b^{p + p!}c^{p}d^{p + p!}$ and $ p > n$
I would like to distinguish $c ^ {p}$. And then... |
I am trying to prove the following Knapsack approximation algorithm, the problem definition:
Input:
A set $S$ of $n$ objects that contains weights and values:
$w_1,w_2,\ldots,w_n$ (weights)
$v_1,v_2,\ldots,v_n$ (values)
$W$ — The total weight bound.
Scaling factor $0 < c < 1$
Output: Let set $\mathrm{OPT}(... |
Feynman's Computer Heuristics lecture was apparently given at the Esalen Institute, Big Sur, California, in 1985. But I have no formal evidence of this. Has anyone ever cited this lecture that you can point out?
|
The Church-Turing is a hypothesis about the nature of computable functions. It states that a function on the natural numbers is computable by a human being following an algorithm, ignoring resource limitations, if and only if it is computable by a Turing machine.
In wikipedia (https://en.wikipedia.org/wiki/Church%E2%80... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.