instruction stringlengths 35 29.1k |
|---|
In their book, Ullman et al says:
Every nonempty CFL without $\epsilon$ has a grammar $G$ in which all productions are in one of two simple forms, either:
$A\rightarrow BC$, where $A,B$ and $C$, are each variables, or
$A\rightarrow a$, where $A$ is a variable and $a$ is a terminal
Further $G$ has no useless symbols.... |
On page 195 of Pierce's TAPL book, he states that one can replace a down-cast operator by some sort of dynamic type test. Then he gives the following rules:
T-Typetest:
$\dfrac{\Gamma \vdash t_1:S \;\; \Gamma,x:T \vdash t_2:U \;\; \Gamma \vdash t_3:U}{\Gamma \vdash \text{if } t_1 \text{ in } T \text{ then } x \to t_2 \... |
Let $G=(V,E)$ be a directed graph, $ω:E→\mathbb{R}$ a weight function, and $s,t\in V$ a pair of different nodes. It's given that $G$ doesn't have a negative cycle. Each edge has the color R or G or B. Find the shortest path under the condition:
we can use green edge after using at least one red edge
we can use blue ... |
In S/Kademlia two crypto puzzles is used, one static and dynamic. The static is used to generate a key pair that makes an eclipse attack difficult to achieve, the dynamic to make Sybil attacks harder.
In the dynamic, I am very confused about the x which is found, since I can’t find any evidence for this ever being us... |
Suppose we are given a directed graph $G = (V, E)$ with edge weights $w : E \rightarrow \mathbb{R}$ (we can assume there are no negative cycles) and edge labels $\ell : E \rightarrow \Sigma$ from some alphabet $\Sigma$. We are also given a description of an NFA $M$ (or DFA, or regular expression) accepting some regular... |
I have an exercise that tells me that, given a problem P (of which now I omit the description) there is no integrality gap between LP and ILP formulation of this problem, and for every fractional LP-solution, there exists an integral
feasible solution with the same cost. Then I have to design a poly-time algorithm that... |
I have an almost linear programme. However one of the constraints has a form $z = min(x,y)$ (all the other things are linear in the model). Is there a way to substitute this with something (or introduce additional variables) to turn this into a linear programme?
In other words, I have the problem that looks like the fo... |
Does there exist a (micro-)kernel of an operating system that is fully implemented in hardware? That is, a kernel that is not stored in RAM, and loaded into CPU registers after an interrupt or system call, but is instead a fully hardcoded part of the CPU itself, so that a system call/interrupt never leads to a context ... |
From theory I know the polynomial reduction is:
reflexive $A ≤ A$ (A Language)
transitive $A ≤ B$ and $ B ≤ C$, then $A ≤ C$ (A, B, and C Languages).
What about symmetric? There is an example with two language $L_1$ and $L_2$ to proof the polynomial reduction is not symmetric? i.e. $L_1 ≤ L_2$ but not $L_2 ≤ L_1$.
|
The list coloring problem is, given a set $L(v)$ colors for each vertex $v \in G$, is there a proper vertex coloring, $c$, of $G$, such that $c(v) \in L(v), \forall v$.
I was wondering, for complete graphs $K_n$, is list coloring NP-complete? Does this change if $\bigcup_{v \in K_n} L(v) = \{1,2\dots n\}$?
|
There are some arbitrary-chosen points in 1D space. What needs to be found is the approximate number of them without counting all of them. It is possible to choose some coordinates (numbers) and for each one there are two numbers returned - the distances to the closest points to the left and to the right.
I'm looking f... |
What is difference between following two problems, their decidability and recognizability status:
Given Turing Machine TM "accepts" given string w.
Given Turing Machine TM "halts on" given string w.
I feel first problem means,
whether given TM "halts by accepting" given string
and second problem means,
whether giv... |
I have a 2D polygon defined by a list of $n$ points: $A$, $B$, $C$... These points are sorted in clockwise order. Example:
I would like to find the most performant algorithm to detect all points which are close together (distance < $x$).In the above example, it is $(H, I)$ and $(B, F)$. I could compare each points wit... |
On the wikipedia page on compilers, it says:
Semantic analysis adds semantic information to the parse tree and builds the symbol table. This phase performs semantic checks such as type checking (checking for type errors), or object binding (associating variable and function references with their definitions), or defi... |
I am taking my question here from there. Consider the following scenario:
You are given a fixed programming language with no nonlocal control flow constructs. In particular, the language does not have
Exceptions, first-class continuations, etc.
Assertions, in the sense of “runtime tests that crash the program if they... |
The dominating set problem is :
Given an $n$ vertex graph $G=(V,E)$, find a set $S(\subseteq V)$ such that $|N[S]|$ is exactly $n$, where $$N[S] := \{x~ | \text{ either $x$ or a neighbor of $x$ lies in $S$}\}$$
My question is if the following (new problem) has a definite name in literature, and if not what should be ... |
I have a question below
In Dijkstra’s Algorithm, if there is more than one possible shortest path from u to any vertex v, any one of the paths can be the output of the algorithms as a shortest path. Assume now that if that is the case for any vertex v, i.e.there are many paths of the same minimum weight, you want to ... |
Are DFAs with a unary alphabet strictly less powerful than DFAs with a binary alphabet? Is this even a meaningful question?
For example, if $\Sigma = \{\texttt{0}, \texttt{1}\}$, we can encode any larger alphabet using $\Sigma$, but if $\Sigma = \{\texttt{0}\}$, this can define a DFA (that say, recognizes $L = \{ \text... |
I found a highly optimized CRC-16 implementation originally intended for microcontrollers. It is noticeably faster than the traditional method, but is hard-coded to model the specific unreflected polynomial 0x1021, or x^12 + x^5 + x^0.
I was then able to determine, when slightly modified, the reflected variant of this ... |
I have a doubt about integrality gap.
If I know that there is no integrality gap for a given problem, i.e.:
$$\frac{\mathrm{OPT}(\mathrm{ILP})}{\mathrm{OPT}(\mathrm{LP})} = 1 \text{ (right?)},$$
then, does it have sense to do an approximation-algorithm with LP-rounding?
I mean, by definition of $\alpha$-approximation,... |
The wikipedia page on capability-based security states:
Capability-based security is to be contrasted with an approach that uses hierarchical protection domains.
However, in order to implement capability-based security, we still need a kernel that ensures that user processes are only able to use the capabilities they... |
I was doing a few dynamic programming problems and I am struggling to understand the thought process required to come up with recurrences.
The first problem I solved was longest palindromic substring and I managed to solve it successfully using the following logic: I have a function f(i,j) which returns the longest pal... |
I have the following randomized-algorithm for the vertex cover problem. Let $B_0$ be the output set:
Fix some order $e_1, e_2, . . . , e_m$ over all edges in the edge set E of G, and set $B_0 = \emptyset$.
Add to $B_0$ all isolated vertices, i.e. the ones without any incident edges.
For every edge $e$ in $e_1, e_2, . ... |
What is the number of RAW dependencies in below set of instructions?
I1: R1 = R2 - R3
I2: R2 = R1 + R3
I3: R3 = R1 + R2
I4: R1 = R2 - R2
I can see the following RAW dependencies in it:
$I_2-I_1\ for\ R_1$ ......... (a)
$I_3-I_1\ for\ R_1$ ......... (b)
$I_3-I_2\ for\ R_2$ ......... (c)
$I_4-I_2\ for\ R_2$ ......... (... |
What I know (NOT strictly speaking): I know that there is an open question about the equality of P and NP Classes and as long as there is no known algorithm that solves NP problems in P time then we make a distinction about the space-time solvability of such problems. Also, I know that you can make reductions (of polyn... |
In the article:
S. Fortune, J. Hopcroft, J. Wyllie, The directed subgraphs homeomorphism problem, Theoret. Comput. Sci. 10 (1980) 111–121.
link:
https://www.sciencedirect.com/science/article/pii/0304397580900092
It is proved that the 2-DIRECTED DISJOINT PATHS PROBLEM is NP-complete in general digraphs. The proof is pr... |
Let $v$ be a vector of positive integers of length $n$. I want to find the highest $k$ such as there are at least $k$ elements of $v$ that are greater or equal to $k$.
What would be the best algorithm for finding $k$?
Examples:
$v = (1, 2, 3, \ldots, 100) \rightarrow k = 50$, because there are at least 50 elements tha... |
We have a 1D function f(x). We would like to approximate this function with a polyline of n points. How can we find the x position for these points so the polyline approximates f(x) with low error (not necessarily optimal but if it was, then even better)?
What algorithms are available to solve this problem? What are th... |
Wikipedia defines strongly NP-Complete as:
A problem is said to be strongly NP-complete, if it remains so even when all of its numerical parameters are bounded by a polynomial in the length of the input.
What I interpret this to mean is this:
Let's consider the 3-partition problem, with our numerical paramater being ... |
The problem description is as below and it feels like a DP problem but I am not sure, thank you for helping!
You have a certain dose of a drug, say, 200 milliliters, and now some patients need this drug. The doses for each patient may vary from person to person, for example, 2.5 milliliters for A, B, C, 5 milliliters f... |
I am asking a simple question. Why we say that we would always get a new hash in a blockchain? Why we can't have collisions?
One way of collision is that the hard disk becomes full and there is no more space to store a transaction.
Some body please guide me.
Zulfi.
|
Is there an efficient algorithm that solves the following decision problem:
Given a strongly connected weighted directed graph $G$, defined by its transition matrix, is there a strongly connected spanning subgraph of $G$ that has no negative cycles?
A strongly connected spanning subgraph of $G$ is a strongly connect... |
Is the an algorithm that would help solve this problem:
Teams are swapping members.
Each team has preferences for members it 'wants' from other teams.
Each member has preferences for the teams its 'wants' to join.
Overall matches can only go through (be accepted) if they are balanced. i.e. the number of people leaving... |
Whilst preparing for the CCC(Canadian Computing Competition), I encountered CCC 2015 Seniors problem 4, linked here.
Anyway, the problem describes a set of vertices(points) numbered from $1$ to $N$, and a set of pathways $1$ to $M$, with pathway $p_i$ connecting two points
$a_i,b_i$, taking time $t_i$. The goal of th... |
A binary string is given to us and we need to find number of awesome substring of that string .Definition of awesome string : A string is awesome if its length is divisible by number of 1's in it.
For example :111 has 6 awesome substrings.01010 has 10 awesome substrings .In "01010" one such awesome substring is "1010" ... |
Between what two common time complexities would you place $n^c lg n, 0<c<1$?
The following table illustrates the common time complexities.
Source: wikipedia
|
Assume a set of functions from ${\{a,b\}}$ to $N$
Where $N$ is the set of Natural numbers.
Let us assume that the size of $N$ is $n$.
i.e $|N|=n$
The first element $a$ have $n$ choices for mapping.
The second element $b$ have $n$ choices for mapping as well.
So the number of functions = $n.n$ = $n^2$.
which is strict... |
Let HALT be the language $\{\langle M, w\rangle : M\text{ is a TM that halts on }w \}$. Let ALLHALT be the language $\{\langle M\rangle : M\text{ is a TM that halts on all inputs}\}$. Use a reduction from HALT to show that ALLHALT is not decidable.
Online (link) I found this (simular) solution:
$D$ = on input $s$:
... |
I have the following randomized-algorithm for the vertex cover problem. Let $B_0$ be the output set:
Fix some order $e_1, e_2,...,e_m$ over all edges in the edge set E of G, and set $B_0=∅$.
Add to $B_0$ all isolated vertices, i.e. the ones without any incident edges.
For every edge $e$ in $e_1,e_2,...,e_m$
if both en... |
From what I’ve read, the CPU has to send the data to the GPU before the GPU can do anything with it. But, if that’s the case, won’t any time saved using the GPU be negated by the time taken to transfer that data? Wouldn’t that kind of defeat the whole purpose of a GPU?
|
Consider below languages:
$L_1=\{<M>|M$ is a regular expression which generates at least one string containing an odd number of 1's$\}$
$L_2=\{<G>|G$ is context free grammar which generates at least one string of all 1's$\}$
Its given that both above languages are decidable, but no proof is given. I tried guessing. ... |
I tried using the padding argument to prove such a thing (as it appeared in Arora's book), but I am not sure how this technique will help me here. I am trying to get to a contradiction to the Time Hierarchy Theorem.
After the assumption, I want to prove that $\mathsf{NP} = \mathsf{DTIME}(2^{n})$.
The first case $\math... |
Given a graph $G$ and $K$ commodities to route from source to destination. I want to find, what is the maximum beneficial flow for each of the commodities and the relevant paths. I understand the problem in general falls under NPC, hence I am looking for FPTAS algorithms.
I am struggling with the problem, so any intui... |
I'm asked to show that the quotient function is primitive recursive. I know that the operation of integer division $div$ is not total, as it is not defined when the denominator is zero, and a recursive function has to be total by definition.
So I could give a function $div'$ and define a value for the case that the de... |
First and foremost, I would like an academic reference on how screen recording "works."
I have tried searching online, but I only get results for the software itself.
Exactly how does screen recording work, and to what extent does the content one records effect filesize?
For instance, if I were to record my screen play... |
I am looking to understand the Chomsky Hierarchy. I've read some textbooks that touch on formal grammars (textbooks on computability, which relate automata to specific sets of formal grammars, notably context-free grammars and regular grammars), but not one that specifically deals with formal grammars as an object.
Is ... |
Considering the following nodes with edge weights in red, Dijkstra's shortest path algorithm seems to return incorrect results, at least by the definition of the steps on wikipedia. By those rules, the distance from 0 to 2 will be calculated by passing through 1 instead of 3.
The final distances (from 0) would come ou... |
First of all, please forgive me if this question shows ignorance on my behalf. What I'm asking is not why we don't program in languages written in binary code, I know the answer for that. What I would like to ask instead is: considering all information we input into a computer is registered as binary code, and all data... |
I am a 2nd year math major who wants to do a PhD in AI. I already have a little background in programming and CS. I have some experience in game design, app development and computer security. I wouldn't call myself an expert, but I am comfortable with C, C++, Python, Javascript C#, Java and Assembly and have written an... |
I am told A(B ∩ C) ≠ AB ∩ AC
I am unsure as to why they are not equal. Using examples and following them I am unable to show that they are not.
e.g Let A = {m} B = {s, p} C = {p, r}
A(B ∩ C) = A{p} = {mp}
AB ∩ AC = {ms, mp} ∩ {mp, mr} = {mp}
Have I made a mistake here?
|
Assume a set of variable $V$ = $\{v_1,...,v_m\}$.
Given total $n$ at-most-one (AMO) constraints (at most one element in a given set is true) set [of the below form], over the variable set $V$,
$$ AMO \, (v_1, v_4, \neg v_6, v_{10}) \\ ... \\ AMO \, (v_2, \neg v_3, v_7)$$
Problem: Find an assignment to $V$ that maximiz... |
I am struggling with exercise from the old algorithmic exam:
$d$ is const for the whole structure.
Propose a structure for which you can do:
Init(S) //called only 1 time
Insert(x, S):: $ S := S \cup \{x\}$ in O(log(|S|)
Delete(x, S):: $ S := S \setminus \{x\}$ in O(log(|S|)
Get(S) = $| \{ a,b \} \subset S : a+b \le ... |
After reading through this paper on optimizing the sum of sigmoid functions, http://www.web.stanford.edu/~boyd/papers/pdf/max_sum_sigmoids.pdf, I am interested in the problem addressed in section 7.3 (Political marketing example). Specifically I am interested in any work on the following problem.
Suppose there is a se... |
Consider the following randomized approximation algorithm of vertex cover:
Input: A graph G = (V, E).
Output: A set $C_G \subseteq V$ a vertex cover of $G$.
The algorithm:
Set $C_G := \emptyset$.
For each edge $e$, in some arbitrary order:
If $e$ is covered, skip it and continue to the next iteration of the loop. ... |
Let $M$ be an $m\times n$ matrix with all elements in $\{1,0\}$, $m >> n$. Let $\mathbf{v}_0, \ldots, \mathbf{v}_n$ be the columns of $M$.
I want to find all sets of columns $S = \{\mathbf{v}_{i_1}, \ldots, \mathbf{v}_{i_k}\}$ so that for every row there is at least one column $\mathbf{v}_{i_j}, \ldots, \mathbf{v}_{i_k... |
I need to find the minimum number out of $N$ vertices on a tree with $N-1$ edges, so that at least $K$ edges of that tree are connected to these vertices.
For example, if $N=9$ and $K=6$ and we have this tree:
Edges | Vertice #1 | Vertice #2
1 1 2
2 1 3
3 ... |
In classical 0-1 knapsack problem we have maximum allowed value for the weight - weight capacity.
Let's restrict total knapsack weight by min and max values
$$
M \leq \sum_{i=1}^{n}{w_i x_i} \leq W
$$
Is there any known algorithm for this problem?
Is there anything known which is better than brute force?
I failed to fi... |
Consider an undirected graph $G = (V, E)$ representing the social network of friendship/trust between
students. We would like to form teams of three students that know each other. The question
is to decide whether the network allows for enough such teams, without checking all the triples
of graph $G$. For this reason, ... |
I use python3 script to find out the area proportion of pixel clusters, threads and points in my image. They are originally 8-bit greyscale TIFF images with a resolution of 2048x2168 pixels. I have binarised it into an image composing of the matrix (white) and component particles (black). The particles have random morp... |
so, I am preparing for an exam which includes lexical analysis from compiler design. I was wondering what is the number of tokens in the following code-
int main() {
/* comment
printf("Hello */ There ");*/
return 0;
}
so, I am thinking upto first "*/" it will be a multiline comment, so, after "there" a string wi... |
We have a group of employees and their company will assign a prize to as many employees as possible by finding the ones probably better than the rest. The company assigned the same $2$ tasks to every employee and scored their results with $2$ values $x, y$ both in $[0, 1]$. The company selects the best employees among ... |
We have a group of employees and their company will assign a prize to as many employees as possible by finding the ones probably better than the rest. The company assigned the same 2 tasks to every employee and scored their results with 2 values x,y both in [0,1]. The company selects the best employees among the others... |
Can polynomial depth circuits (with, let's say AND, OR, and NOT gates) be simulated in polynomial time?
|
Given a collection of objects $X = (x_0,x_1,...,x_{N-1})$ and a binary predicate $F$ which takes as parameters elements of the collection, find a better than $\mathcal{O}(N^2)$ algorithm which partitions the set as:
$X= \bigcup X_j$
such that for any $j$ it holds that $F(x_k,x_l) = 1$ if $x_k,x_l \in X_j$ and $F(x_k,x_... |
Sorry for the lack of clarity in the question description.
I have an array composed of length $N$ composed of $K$ linear subarrays. We define a linear subarray as a contiguous subarray of the array $[l,r]$ where $A[i]-A[i-1] = C$, a constant, for all $l<i<=r$. (Note: $C$ may be different for different subarrays; the el... |
Hello Stackexchangers,
I've come across a confusion in one of my exercises.
I was supposed to prove $\Pi_{n+1}^{p} = (\textit{co-NP})^{\Sigma_{n}^{p}}$, where the superscript operator in $M^{A}$ refers to a TM $M$ having access to an oracle in $A$.
I have two rules: $\Pi_{n+1}^{p} = co-\Sigma_{n+1}^p$ and $\Sigma_{n+1... |
I am not able to convert the following language to a Context Free Grammar. The major problem is how to pump both "sides" of the word to obtain same number of 0s and 1s, but, without creating a series of 01010101.
$$L=\{0^{r_1}1^{s_1}0^{s_2}1^{r_2}\mid r_1+r_2 = s_1 + s_2,\ \ r_1,r_2,s_1,s_2 > 0\}$$
Can someone explain... |
I've been learning on Formal Languages and Automata of Peter Linz(6th edition).
In the chapter 3 of this book, it explains the primitive regular expression.
But I don't know what is the difference between $\phi$ and $\lambda$.
Of course, I know $\lambda$ means the empty string, so that $\lambda s=s\lambda$.
And the t... |
I had quiz last week and it says: suppose algorithms $A_1$ and $A_2$ have worst-case time bound $p$ and $q$, respectively.
Suppose algorithm $A_3$ consists of applying $A_2$ to the output of $A_1$. (The input for $A_3$ is the input for $A_1$.)
Give a worst-case time bound for $A_3$.
How could I calculate the worst case... |
What can we say about decision problems having a polynomial time algorithm, ie, in $P$? Do they always have polynomial sized circuits (but not circuits of polynomial depth)?
|
Lets consider sequences whose elements are $-1,0,1$.
Subsequence $A[i...j]$ is $good$ if sum of its elements $=0$.
Example: for sequence $1,1,0,-1,-1,1$ subsequence $1,0,-1,-1,1$ is $good$.
Subsequence $A[i...j]$ is $supergood$ if it is good and every its prefix-sum is $>= 0$
Example: for sequence $1,1,0,-1,-1,1$ ... |
I'm trying to construct a turing machine that accepts any random binary numbers. From the theory (and partial example) in this video, I understand (correctly?) that this is something that is more easily doable with a Non deterministic turing machine.
So I have come up with a concept as such that I start with state Q1 ... |
Would appreciate any insight about the following regarding set covers:
Begin with a universe set $X = \{x_1,x_2,...,x_n\}$ and a set $S=\{s_1, s_2,...,s_p\}$ such that each $s_i \subseteq X$ and $\bigcup S = X$. Consider the task of finding all inclusion-minimal covers of $X$. (Covers are inclusion-minimal if the r... |
It is well-known that the Segment Tree performs range additions and range minimum queries in O(logN) each.
Let each element in the array have value V[i], M[i]. We define a "range modulo add" as the following: add +X to V[i] for each element in the range L<=i<=R and then calculate modulo M[i] for each element L<=i<=R. C... |
Is there a formal complexity measure for lambda expressions which satisfies the Blum axioms and measures the complexity of reducing the expression to its normal form?
I assume that the complexity measure would have to operate on the Godelization of the lambda expression, as in "Gödelization in the Untyped lambda-Calcul... |
Yesterday our Professor told in the class that Thomas Write rule ensures view serializability, but while surfing on this topic today on internet I am not able to find any information about that claim. So is it always $TRUE?$
What he told was this-->
Timestamp ordering ensures conflict serializability
Thomas write rule... |
Consider the following BNF
<join-command> ::= <string> + <string>
In this context <join-command> and <string> are normally called metalinguistic variables or syntactic categories. Note that the first usage of <string> don't necessarily represent the same terminal string as the second usage.
Recently however I come acr... |
If we have a 2d matrix of max dimension, 95x95 and we have at max 12 candies placed in some cells. We always start from top left corner(0,0) and we need to reach some given destination (x,y) after having collected ALL the candies. There are some cells which are blocked and hence cannot be visited.
Let 10 represent empt... |
Consider an undirected graph $G=(V,E)$ representing the social network of friendship/trust between students. We would like to form teams of three students that know each other. The question is to decide whether the network allows for enough such teams, without checking all the triples of graph $G$. For this reason, we ... |
how proof ${\ \ NPC \ \ \bigcap \ \ CO-NPC \ne \varnothing }$ then
${NP = P ? }$
|
Consider the Independent Dominating Set problem with a directed graph $G=(V,E)$ as instance and the properties that:
$\forall (u,v) \in E, \{u,v\}\nsubseteq S$
$\forall v \in V: v \in S \lor \exists (u,v) \in E: u \in S$
then consider the function $f$ which is a many-one reduction from IDS to SAT for $G$:
$$f(G)= \bi... |
I would like to have a good conceptual understanding of the semantics of programming languages: operational-, denotational-, axiomatic-, categorical-.
Is there a good (standard?) textbook for this?
|
I recently learnt about Quine-McCluskey and Petrick's methods and they are all okay by me using minterms the procedure is as follows :
1- Reduce the prime implicant chart by eliminating the essential prime implicant rows and the corresponding columns.
2- Label the rows of the reduced prime implicant chart $P0,P1,P2,...... |
Say I have a list, L, of m things.
I want to pick n things out of the total of m things in the list.
Suppose there are W ways of doing this. I want to choose the kth way where k is in the range 1..W.
i.e. my function is this:
ChooseKthChoiceOf(L,n,k){
....
}
Any good algorithms for this?
|
Let $D=(V,B), n=|V|$ be a directed graph. Then the graph contains a circuit of negative length from $s$ if and only if $f_n(v) \neq f_{n-1}(v),$ where $v \in V,$ and $f_k(v)=$min$\{l(P)|P$ is an $s-v$ walk traversing at most $k$ arcs }.
I do not understand what a $s-v$ walk means and what is the meaning of the function... |
I know that this is not a question answer site but for sake of explaining my doubt I have to post the entire question..
Consider the following statements.
If relation R is in 3NF and every key is simple, then R is in BCNF
If relation R is in 3NF and R has only one key, then R is in BCNF
Both 1 and 2 are true
1 is tru... |
Consider the following binary recursive fibonassi program:
Algorithm binaryFib(k) //k is assumed to be non-negative integer
if (k <= 1)
return k
else
return binaryFib(k-1) + binaryFib(k-2)
end binaryFib
The recurrence relation for above is:
$T(n) = T(n-1) + T(n-2)$
The run time complexity for the sa... |
I am trying to proof the properties of the complement and concatenation of two non-context-free languages $L_1$ and $L_2$.
I believe that both of these languages are closed under complement and concatenation but can't seem to find a solid proof for it. I'm leaning towards them being closed because I can't find any coun... |
Consider two sets of the same length that both contain every $n$-bit value. The first set is sorted, but the second set is unsorted and randomly arranged. Since both sets contain all possible $n$-bit values, they each have a size of $n*2^n$ bits. Now the task is to find what value in the sorted set, $a_i$, corresponds ... |
prove or disprove
$$\text{If } f(n)=g(n)+h(n), \text{ then } O(f(n)) = O(g(n))+O(h(n)).$$
I have no idea about where to begin.
what are the theories which should be used here?
|
I remember from my reading of Category Theory for Computing Science that classical concepts like weakest preconditions can be seen as the categorical notion of pullback.
I was wondering if the same is true for the notion of most general unifier.
|
Consider 2 DFAs both determining a language $L$. Both DFAs have the same number of states $n$. Can I then conclude that these two DFAs are isomorphic?
I think the answer is yes, because if I'd make an $MN(L)$ relation with $n$ equivalence classes and map it to a $DFA$, there'd only be one result (at least I believe s... |
I know this is not a question answer posting site, but for sake of explaining my doubt I will like to post a question
Say you are given table like
R(A,B,C,D,E,F)= {AB→C, BC → A, AC→ B , B → D , D→ E }
Now how will you figure out how many tables are needed to decompose this function in $BCNF?$
Is there any short form... |
I am an IB student doing SL math. For my math IA i picked the topic of monopoly and the optimal way to play. However, in this IA there is a massive matrix that needs to be built to see how the long term possibilities of landing on a given square. I found someone's code on this page https://arxiv.org/pdf/1410.1107.pdf, ... |
It could be a silly question, yet I'm not able to understand.
In modern day, computers, we have integers with million digits length. Even in my ordinary 2GB laptop, I can calculate values of numbers up to thousand digits long, but the value of a floating-point calculation is often limited to 15 digits or worse, like 0.... |
I am interested in the hardness of the following question.
Suppose we have a vector of $n$ optimization variables $\mathbf{x} = \langle x_1, . . ., x_n\rangle $ and $m$ vectors $\mathbf{v}_1, . . .,\mathbf{v}_m$ with each $\mathbf{v}_j \in \{-1,1\}$.
Our objective is to maximize the number of nonnegative dot products b... |
So I need to find a reduction to the (undecidable) problem of deciding if two Turing machines $M_1$ and $M_2$ behave the same way on an input $x$. "Behaving the same way" is defined like this:
$M_1$ and $M_2$ behave the same way on an input $x$, when they both don't halt, or when they both accept $x$ or when they both... |
I saw a very interesting question regarding Elgamal cryptosystem that I don't know its answer. It is really interesting and I would be very happy if you could elaborate on it and explain the tricky part.
It goes like this: given Elgamal Cryptosystem:
1) Show how it is possible to create a valid new encryption from two ... |
Reading a bit about Joy, I was wondering if there wasn't an algorithm to switch from classical notation and style to concatenative and stack-based style.
Of course, for simple mathematical expressions without variables, for example, you just have to convert the expression into the inverted Polish form:
f = 3 + 5 * (7 -... |
Graph isomorphisim is not proven to be NP-complete what would it imply if it were possible to prove that there are some problems which are in NP set of problems but not in NP-complete set.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.