instruction stringlengths 35 29.1k |
|---|
I'm reading Types and Programming Languages and trying to understand the solution to exercise 5.2.4 on untyped lambda calculus / Church numerals:
Define a term for raising one number to the power of another.
The proposed solution says:
$\textrm{power2} = \lambda m. \lambda n. m~n$
In an attempt to understand how th... |
Assuming you have a balanced tree, without parent-pointers, with $n$ nodes, and a height $H = \mathcal O(\log n)$.
I know you can traverse the tree in level order in $\mathcal O(n)$ time using a queue. However, even in a balanced tree, the queue can grow to $\mathcal O(n)$ in size.
So the best I came up with is essenti... |
Let us consider the following scenario,
The cpu started executing a program, which is in secondary memory with n lines of code, so, it brings m ( < n ) lines of code in to main memory and started executing.
We can call the m lines of code, which are in main memory as process.
But my doubt is that, what about the remai... |
Set S is a set consisting of all string of one or more a or b such as "a, b, ab, ba, abb, bba..." and how to prove set S is a infinity set.
I have tried proving set S as one to one corresponding to natural number set in binary form. like a = 0, b = 1. However, I am stuck in proving it since there are more than one "1",... |
I'm only a layman therefore only discuss stuff naïvely.
I read some introductory articles about halting problems with a scenario that if there were such a decider accessible to us, we should be able to solve some unsolved mathematical problems. We could write some brute-force programs to check Goldbach conjecture, say,... |
If $NP=coNP$ does it hold that $P/Poly=PH/Poly$ and/or $NP\subseteq P/Poly$ and/or $VNP=VP$?
What can we legitimately say if $NP=coNP$?
|
If I modify a 3-COL problem (with colors A, B, C) in a way that I now demand that at most, say, 50 vertices may be colored with color A, does the problem still remain NP-complete?
I've been thinking of a reduction from a standard 3-COL, but there is no way that I can solve a standard 3-colorability using the problem de... |
Suppose we have a graph $G = (V, E, w:e\in E \to x \in \{0,1\})$. That is, a set of vertices, a set of edges and a weight function that assigns edges weights of 0 or 1.
Suppose we also have a subset of vertices $S \subset V$ and that we want to find a minimum-weight tree that spans the vertices in $S$. Since the vertic... |
The following is an excerpt from OS concepts by galvin.Here is the book.
Multithreading Models
Our discussion so far has treated threads in a generic sense. However,
support for threads may be provided either at the user level, for user
threads, or by the kernel, for kernel threads. User threads are
supported above th... |
Say I have the following grammar:
E -> TE'
E' -> +TE'| -TE' | λ
T -> (E) | id
I need to build the finite state machine with the LR(0) items,
But I know in order to do this I have to remove the λ.
How to I accomplish this ?
Also, after I have the SLR(1) table, how to I prove is valid ?
Thanks, I'm studying for a... |
Given $n$ points with integer coordinates in the plane, determine the maximum number of points that lie on the same circle (on its circumference, not its interior).
This can be done in $O(n^3)$ easily by trying $\binom{n}{3}$ combinations of points and counting the number of occurrences of all circles found with hash... |
I'm trying to understand how to create a DFA on the language $\{a,b\}$ that accepts strings where the number of $a$s is not a multiple of n.
Creating a DFA with no. of $a$s divisible by $n$ is easy. One simply makes $n$ states such that the string ends into the accept state per every $n$ of e.g. $a$s.
I've figured out ... |
I've had to come up with a traversal order/algorithm for a project, and I am wondering if it has a name.
The requirements of the algorithm are:
it visits the parent before the children.
it visits all the children in one group.
it is otherwise depth-first.
I basically modified a pre-order to visit the siblings all tog... |
I'd like to preface this question by saying that it is not a homework question. However, it is a question regarding the course material. In the rod-cutting example an equation is presented to determine the maximum possible revenue attainable for give rod length:
$r_{n} = max(p_{i} + r_{n-i})$ (15.2)
I'm trying to prove... |
I am solving an exercise from the book of Cormen et al. (Introduction To Algorithms). The task is:
Show that solution of $T(n) = T(\lceil n/2\rceil) + 1$ is $O(\lg n)$
So, by big-O definition I need to prove that, for some $c$,
$$T(n) \le c\lg n\,.$$
My take on it was:
$$\begin{align*}
T(n) &\leq c\lg(\lceil n/2\... |
Why does the following DFA have (to have) the state $b_4$?
Shouldn't states $b_1,b_2,b_3$ already cover "exactly two 1s"?
Wouldn't state $b_4$ mean "more than two 1s", even if it doesn't trigger an accept state?
|
I have the following python code
x = [100.0 for _ in range(1000)]
for i in range(1, len(x)):
x[i] = x[i-1] + (2*randint(0, 1)-1)*step_size
import numpy as np
print np.corrcoef(x[:-1], x[1:])
I am getting extremely high correlation values, over 99.9%, more precisely
[[ 1. 0.99785636]
[ 0.99785636 1. ... |
I'm planning to teach a winter course on a varying number of topics, one of which is going to be compilers. Now, I came across this problem while thinking of assignments to give throughout the quarter, but it has me stumped so I might use it as an example instead.
public class DeadCode {
public static void main(Strin... |
I came across the question Is there an algorithm that provably exists although we don't know what it is? I was able to follow the example "Given an integer $n\ge0$ is there a run of $n$ or more consecutive 7s in the decimal expansion of $\pi?$" given in one of the answers. The answer shows that the problem in example i... |
I have an assignment for school, in which I have to build a neural network that will play tic tac toe, using genetic algorithms for training. The thing is that I am clueless on how to connect the two. I need help in the design. Should use the GA to generate game boards, to serve as input for the neural network. Or, sho... |
I'm looking to understand how can one graph the following DFA given its mathematical definition.
Take for example this (from [1], p. 107):
Set of States: $Q = \{q_{\langle carry=0\rangle}, q_{\langle carry=1 \rangle}\}$
Alphabet: $\Sigma = \{\langle x_{i}, y_{i}\rangle \mid x_{i},y_{i}\in[0..9] \}$
Start State: $s = q... |
I am stuck on the following question.
If $L$ is regular show that $\text{even}(L)$ is also regular. Here $\text{even}(L) = \{ \text{even}(w) : w \in L \}$, $\text{even}(w)$ is the string obtained by extracting from $w$ the letters in even numbered positions. For example, if $L=\{0, 01, 02, 0202, 12120\}$, then $\text{... |
Given $T_1, T_2\colon \Sigma^* \to \Gamma^*$ ($\Gamma$ is output alphabet), let $\Delta(T_1, T_2)$
consist of all input strings $w \in Σ^*$ where $T_1(w) \neq T_2(w)$.
Prove that FSTs are not closed under this operation $\Delta(T_1,T_2)$.
What I have tried is to create two FSTs $T_1, T_2$ (as 5 tuple fu... |
In the context of the very recent talk by Lazlo Babai outlining that Graph Isomorphism (GI) is Quasi Polynomial Time, what are the broader implications of this result? (I'm assuming the claim will stand peer review)
http://people.cs.uchicago.edu/~laci/quasipoly.html
https://twitter.com/gabegaster
Apart from the inhere... |
If I am not mistaken, a tree is any graph that does not contain cycles.
However, I am currently taking a bioinformatics course where we deal a lot with algorithms on phylogenetic trees. Usually you are given a phylogenetic tree with $n$ leafs, and then you run some algorithm that can do something trivial like simple tr... |
I am intrigued by and understand the very basics of Proof Carrying Code (PCC) and I recognize that LLVM is a machine-independent intermediate language. LLVM is the intermediate form of many languages, including the new Rust language. Typed Assembly is another style of intermediate form which can be used to generate P... |
Does the concept of the array (a sequence of equally-sized elements accessible in O(1) time, occupying O(n) space) pre-date physical computer memory implementations?
I am trying to gauge whether computer memories were designed for the array or whether the array concept was designed to work with computer memories.
|
I was reading this article on gperf.
In it they claim that the use of nested if statements for parsing command line input of $N$ options ends up making $O(N^2)$ comparisons. (If I had just made one if for each option would it not be $O(N)$?)
Later on, they say that if instead the perfect hash function that gperf provi... |
True or false:
An intersection of a Turing-recognizable and a regular language is always Turing-decidable.
This was asked on a practice test and the answer is False. Why? I thought regular languages were a subset of decidable languages. So if you intersect regular and recognizable the result would also have to be a sub... |
I'm trying to make a pattern that looks like this:
And am given this code to start:
import static java.lang.System.*;
class TriangleWord
{
private String word;
public TriangleWord()
{
word = "";
}
public TriangleWord(String w)
{
setWord(w);
}
public void setWord(String w)
{
word = w;
}
public String t... |
I need some help with a program that will fill in objects that pop out from the background. For example I have this picture and would like to get an output like this. I don't know how to do this though (obviously otherwise I wouldn't be asking). And I was wondering if there was some way of filling in objects that don'... |
Is there any way to find generalized formula to calculate the number of paths of different length between two nodes of the network connected in mesh topology, given that the network contains n nodes?
|
(pseudocode)
f(x,y,z)
{
if (x < y)
{
return 1 + f(x + 1, y, z)
}
else if (y < z)
{
return 2 + f(x, y + 1, z)
}
else
{
return z
}
}
The function call f(12,14,20) returns $40$. Why is this the case? As the final statement is return z, should it not simpl... |
Let $A$ be a DFA and $q$ a particular state of $A$, such that
$\delta(q, a) = q$ for all input symbols $a$. Show by induction on the
length of input that for all strings $w$, $\delta^* (q, w) = q$.
I'm completely new to the subject. But this is what I have done. Can someone please tell me if this is the correct s... |
In my book:
The set {abb, a, b, bba} is said to be converted into regular expression abb + a + b + bba.
The set {01, 10} to regular expression 01 + 10
Does the +'s here represent concatenation or union?
|
It is said that any term on the calculus of construction halts. I am studying it through Morte, which is a bare bone implementation of the coc available on github. Is there any simple proof of normalization for the calculus of constructions? If the proof isn't simple, is there an simple intuition behind the result?
|
Let $P$ be an $m \times m$ antisymmetric matrix of the form:
$$
\begin{bmatrix}
0 & p_{1,2} & ... & p_{1,m} \\
-p_{1,2} & 0 & ... & p_{2,m} \\
\vdots & \vdots & \ddots & \vdots \\
-p_{1,m} & -p_{2,m} & \dots & 0 \\
\end{bmatrix}$$
with $p_{i,j} \in [+1,-1]$, how can I find a set $I^*$ of matrix rows that maximizes the ... |
$\Sigma=\{a,b\}$, $L=\{w\in \Sigma^* \Big| |w|=3n+5m, \ n,m\ge 0 \}$.
I need to build NFA automaton for $L$....
Now, I try it for hours but I don't have any idea how to solve it.
I know that any $x\ge 8$ can be written as $3n+5m, \ n,m\ge 0 $
So, the automaton accepts any word the her length is 8 or higher, but it does... |
I have the language
$\qquad L=\{ a^s b^t c^m \mid s,t,m \; \in \; \mathbb{N^{+}} \text{ and } t<4, s \cdot t=m\}$.
How do I go about designing a PDA for it ?
I can't figure out a way to deal with $m$.
|
$ALL_{TM} = \{\langle M\rangle | \; M$ is $TM$ and $L(M)=\Sigma^*\}$
$E_{TM} = \{\langle M\rangle | \; M$ is $TM$ and $L(M)=\emptyset\}$
I can't find reduction of $ALL_{TM}$ to $E_{TM}$. But I can't proof that it does not exist.
Is there is such a reduction?
|
For an assignment, I need to draw a diagram of Von Neumann architecture, and explain each part of it.
All the diagrams and explanations I've seen have a distinct "Memory" block that holds both the code and the program data of running processes. What I can't find information on however is if this memory refers to only p... |
Why is the language $A=\{wtw^r: w,t\in\{0,1\}^*\text{ and }|w|=|t|\}$ not a context free language?
It is turning out to be really tricky. Is there an easy way to show this?
|
Let's suppose I have two functions $F$ and $G$ and I'm interested in determining whether
$$F(x) = \int G(x)dx.$$
Let's suppose that my functions are composed of elementary functions (polynomials, exponentials, logs, and trigonometric functions), but not, say, Taylor series.
Is this problem decidable? If not, it is it s... |
How do I solve the recurrence relation $T(n)=n+T(n/2)+T(n/4)+\cdots+T(n/2^k)$, for constant $k$?
I am told that the answer does not depend on $k$.
|
Some problems such as sorting have famous complexity lower bounds (ex: $O(n \log (n))$ in this case) but I feel that doesn't totally remove the possibility of improving algorithms by shaving constants. Are there any really non trival, perhaps not practical sorts, that have excellent constant performance? For example do... |
What is the relation and difference between a programming model and
a programming paradigm? (especially when talking about the
programming model and the programming paradigm for a programming
language.)
Wikipedia
tries to answer my question in 1:
Programming paradigms can also be compared with programming models that... |
I know this is a fairly poorly worded question, but I can't think of a better way to phrase it in the title.
So in Radix Sort, you go digit by digit from least significant to most significant, and along the way you are swapping elements around. When considering the case where two digits are the same, do you look at th... |
Can someone explain how exactly Successive Shortest Paths (SSP) is a generalization of the Ford–Fulkerson algorithm? I've found this stated in a few papers and websites as well as the Wikipedia page for the Minimum-cost flow problem. But none of them go any further than that statement or explain how exactly they differ... |
In a $k$-way set associative cache, the cache is divided into $v$ sets, each of which consists of $k$ lines. The lines of a set are placed in sequence one after another. The lines in set $s$ are sequenced before the lines in set $(s+1)$. The main memory blocks are numbered 0 onwards. The main memory block numbered $j$... |
An array $a[1,\ldots,n] \subseteq \{1,\ldots, k\}$ is given, where $k < \sqrt{n}$.
Our goal is a project algorithm which sorts it in place and in time $O(n\log k)$.
We assume that $k < \sqrt{n}$ - otherwise $O(n\log k) = O(n\log n)$ - then we may use HeapSort.
We may assume that we know $k$. I try to do it. The on... |
Consider a cashier machine that takes payments in coins. We feed the machine coins one by one until the value is more than the amount we should have paid. Then the machine returns the extra amount in coins in the least number of coins possible. So we have k type of coins and a limited amount of each type. Also the mach... |
Given that some shapes overlap in an image, are there any papers or articles or code which can infer the original shapes from the overlapping?
I am thinking to apply some machine learning to this since I can generate overlapping shapes using code and use a neural network to try to work out the original shapes. Perhaps... |
I don't want to binarize a certain image through another program, I want to know how to binarize things myself. All I know is that there is something to do with a threshold and if it is above the threshold it is either 1 or 0 and the opposite if below. My images are using RGB but I can also use HSB or HSV. I just want ... |
Lets say we have $L_1$, which is a regular language and $L_2$ which is not. Are $L_1 \cap L_2$, $L_1 \cup L_2$ , $L_1$ \ $L_2$ and $L_1 \cdot L_2$ are always non-regular languages?
We know that two regular languages always gives us a regular language under all of the above. I can't find anywhere any proof that combina... |
I'm trying to figure out if:
$\log^2n = O(n)$ and
$ n = O(\log^2n)$
are true or if one or both are false.
So far I've concluded that both are false because if $n = 8$ for the first one, then $\log^2 8 = O(8)$ which is false since it simplifies to $9 = O(8)$ which does not belong to $O(n)$.
For the second one, I belie... |
Are there any problems apart from chromatic number, which is $FPT$ when parametrized by (the size of a minimum) vertex cover, and that does not admit a polykernel when parametrized by (the size of a minimum) vertex cover (under standard complexity assumptions)?
|
I have two questions as in the title:
TM M accepts some string of length greater than 100
TM M accepts some string of length at most 100
Since 1. is infinite, we can rephrase question as "does TM accept a string", which is clearly undecidable and there are many proofs for that.
2nd question on the other hand is fini... |
Is the variation of partition problem where instead the sum of the sets only be equal to a value $B$, they could also differ by two ( i.e., the sum of one set could be $B-1$ and the other $B+1$ ) still $NP$-complete?
|
If the question appears vague, I'll gladly clarify. It's not tied to a programing language. If there is a language dependency in the answer, one can place it in the context of Python, R, VB, Mathematica, Matlab, or seek clarification.
Are there situations when a vectorized (aka element-wise application of a function or... |
This is a homework problem I've been given and I've been raking my brain for hours (so I'm satisfied with some pointers). I know already that the approximation ratio cannot be worse than $2$. I have a wheel graph, where each edge has cost $1$ and the distance between all nodes which are not connected by edges is $2$. T... |
This semester I was introduced to finite automata (FSM), then pushdown automata (PDA), and now the Turing machine (TM). Granted that there're many possible implementations of these abstractions (electrical, mechanical, whatever...), I find the terms used in describing these machines rather extravagant. It's as if the t... |
The refinement order on partitions of an integer $n$ can be defined as follows: $\lambda=(\lambda_1,\dots,\lambda_k)\leq\mu=(\mu_1,\dots,\mu_\ell)$ if there is a partition of the parts of $\lambda$ into blocks whose sums are the parts of $\mu$.
It is known that the problem of deciding whether $\lambda\leq\mu$ is NP-com... |
I was trying to code the Ullman subgraph isomorphism agorithm. With respect to the Ullman subgraph isomorphism, there are two matrices, M and M'. How is M' being formed from M?
Matrices M' are generated by systematically changing to 0 all but one of the l's in each of the rows of 0 M, subject to the definitory condit... |
Before I'll ask my question, let me start with my understanding of the definitions, to prevent myself with further confusion, as well as giving some background.
Huffman Code is the binary-code induced from a binary tree, constructed by Huffman's Algorithm.
Hu–Tucker Code is the binary-code induced from an alphabetical ... |
Consider a directed graph. I need to find a path that visits maximum number of strongly connected components in that graph. If there are several such paths the desired path is the path that visits minimum number of nodes (shortest path).
I have created a DAG from the directed graph and performed a topological sort on... |
I want to find the minimal period of any state of an LFSR (except the initial state of all zeroes) whose characteristic polynomial is the product of two primitive polynomials.
In particular, $f(x),g(x) \in GF(2)[x]$ are primitive polynomials of order $n$, and the characteristic polynomial of the LFSR is given by:
$$c(x... |
I have a question related to a paper of Chen, Lovasz and Pak [1].
The paper concerns the construction of the Markov chain with optimal mixing time on an arbitrary graph.
They prove the optimal bound (conductance bound) can be reached by "lifting" the Markov chain, this comes down to extending the local node features wi... |
If the universe were governed by predeterminism (i.e. some deity decided in advance how everything, ever, would play out), would the notion of non-deterministic automata make sense? Or would it not, but we wouldn't know it?
|
Let $A$ and $B$ be two languages. If $A \le_{m} B$ ( reducible by mapping ) then I know that if $B$ is decidable so is $A$ and if $B$ is recognizable so is $A$. And if $A \le_{T} B$, then if $B$ is decidable so is $A$. But I can't say the same thing for recognizability which I can see by example when $A \equiv L_{\p... |
Why a production rule $S\to ε$ has been included in the definition of regular grammar? In that case, why it is restricted for $S$ (start symbol) to be present on right hand side of any production rule?
|
I need to apply the unification function to unify the following expression:
foo(X,X,Y) and foo(Z,p(Z),w)
So far, I've determined that I must substitute 'w's for occurances of 'Y', making
foo(X,X,w) and foo(Z,p(Z),w)
Then, I can saw X/Z (replaces 'Z' with 'X'), making:
foo(X,X,w) and foo(X,p(X),w)
Now all that's left is... |
I was reading about external merge sort from the wikipedia article link, according to it:
External sorting is required when the data being sorted do not fit
into the main memory of a computing device (usually RAM) and instead
they must reside in the slower external memory (usually a hard drive).
External sorting... |
Given a set $A$ of $n$ positive integers $a_1, a_2,\ldots, a_n$ and another positive integer $M$, I'm going to find a subset of numbers of $A$ whose sum is closest to $M$. In other words, I'm trying to find a subset $A′$ of $A$ such that the absolute value $|M - \sum_{a∈A′}a|$ is minimized. I only need to return the su... |
I was tasked with constructing an integer programming formulation for an NP-hard problem, and then with specifying its LP relaxation and the resulting approximation factor.
The problem is that, while my integer programming formulation is correct and clever (I like to think), it seams that its relaxation is completely u... |
One time I saw a theorem that says something like any language can be partitioned into regular languages, but I can't remember exactly what the theorem is.
Could somebody tell me, is this true? What is this theorem?
|
Many hash table implementations found in programming languages (such as Java's HashMap or Python's dict) dynamically increase the size of the hash table once the number of items reaches a certain threshold. In these cases, resizing the hash table means allocating a new, larger memory area, re-hashing all the items and ... |
I have the relations $E_1$ and $E_2$.
A reflexive, symmetric and transitive property shows that two relations are equivalent to each other. I need to prove if this is true for the following
a) $E_1 ∩ E_2$
b) $E_1 ∪ E_2$
c) $E_1 ∘ E_2$
I found out that a) is true, but I am not sure about it.
This is my proof for transit... |
I have asked this on the "computer science chat" ( vzn tried to explain me ) . I even watched a couple a videos to understand the theorem but still cannot convince myself. The following is the way the Godel's Incompleteness theorem is proved in Sipsers, where it is shown not all true statements are provable:
Notations... |
In System F, we distinguish between types and terms. Types are defined by the following BNF:
\begin{align}
A, B ::=&~\alpha && \text{(type variable)} \\
&|~A \rightarrow B && \text{(function type)} \\
&|~\forall \alpha. B && \text{(universal quantification)}
\end{align}
Terms are defined by the following ... |
I'm trying to count the number of divisors an integer $n$ has. The simple way to do this is to just enumerate all integers from 1 to $\sqrt{n}$, and count how many integers evenly divide $n$.
For example, 28 has six divisors (1, 2, 4, 7, 14, 28). 15 has four (1, 3, 5, 15). I want to, say, figure out how many divisors ... |
I apologize if this question has been asked before, but I was not able to find a duplicate.
I have just finished reading The Annotated Turing and I am a bit confused.
From what I understand, the Entscheidungsproblem is whether or not an algorithm exists that can determine whether a statement is provable. In the paper,... |
I'm trying to build a machine learning classifier that can detect which object is in an image. I have a labled training set of images and am currently in the image processing phase. Each of these images has one of the objects. However, almost all images have these objects embedded in a very common background color amon... |
I just read some pages in Sipser's book Introduction to Theory of Computation about Post Correspondence Problem, and I'm thinking that PCP is actually in NP. The certifier is: for an input configuration of pile
$$(t_1/b_1, t_2/b_2,...t_n/b_n)$$
concatenating $t_1, t_2,...,t_n$ as a string $t$ and concatenating $b_1, b... |
I've met in a book the following algorithm that computes the exponential:
Input: $t, n$ ($n$ is the number of steps)
Output: $E_n$
$\begin{array}{l}
\mbox{define $t_0 = 0$ ; $E_0 = 1$} \\
\mbox{build two sequences $t_i$ and $E_i$ as follows} \\
t_{n+1} = t_n + ln(1 + d_n 2^{-n}) \\
E_{n+1} = E_n(1 + d_n 2^{-n}) \\
d_n ... |
As I understand regular languages can be closed under concatenation, so can I concatenate the set of all regular expressions to classify them as regular?
|
I am looking for (practically) efficient algorithms to enumerate all minimum feedback arc sets of a directed graph. What algorithms should I look at, with practical implementations in mind?
Currently I am using this algorithm to find all minimal solutions, then pick out the smallest ones:
B Schwikowski & E Speckenmey... |
Is the language $L = \{w w^r w w^r \mid w \in \Sigma^*\}$ context-free? ($w^r$ is the reversal of $w$.)
I heard that by using the pumping lemma, we can only prove that a language is not context-free, but can't prove that a language is context-free. I tried the pumping lemma and we can produce the language by repeating ... |
As I understand it the nature of data access (sequential or random) will determine the optimal algorithm/data structure to use when manipulating data.
What other assumptions need to be checked before selecting an algorithm or data structure for the manipulation of data?
|
Following this question : Two definitions of balanced binary trees
I am having a hard time making sense of the proofs provided and I'm looking for an example of a simple binary tree that is height-balanced but not weight-balanced.
This would mean that we could clearly see the height differences of two sub-trees being m... |
It is given array $2$-sorted array $a[1..n]$. $2$-sorted denotes that $a[1]\le a[3]\le...\le$ and $a[2]\le a[4]\le ..\le$
Obviously we may split array into two sorted arrays and then merge two arrays - it requires $n-2$ comparisons. However I think about lower bound. I believe that $n-2$ is lower bound number of co... |
I was reading about Benes Network construction in this book.
Their construction is easy for a number of inputs and outputs that is an exponent of two.
However it seems to me that for a number of i/o that falls between $2^{n}$ and $2^{(n+1)}$ one has to construct a network with $2^{(n+1)}$ ports and leave many unattach... |
Lookup tables are one way to map x values to f(x) values. This lets you do computation in advance, and can give a low cost (performance wise) answer to complex calculations when they are needed in performance intensive applications.
Another method to map x values to f(x) values is to use the chinese remainder theorem ... |
Is $\left ( 0+1 \right )^{\ast }-\left \{ www : w \in \left \{ 0,1 \right \}^{\ast } \right \}$ context-free?
If it is what is a grammar generating it?
|
I am working on my midterm sample problems and got stuck on this one. Is this language undecidable?
$\qquad L = \{\langle G_1, G_2 \rangle: G_1, G_2 \text{ are CFG and have strings that can be parsed in both grammars }\}$
Is this one the same as $L' = \{\langle G_1, G_2 \rangle: L(G_1) \cap L(G_2) \ne \emptyset\}$? M... |
This is a bit of a long shot but i'm currently working on a research project in psychology/public health. One of the aims of this project is to develop a typology/"conceptual map" of how things in the proximal environment (i.e. close to an individual or inside rooms) can be changed in order to alter behaviour (the proj... |
Given two languages $L_1$ and $L_2$, give a language $L'$ that both $L_1$ and $L_2$ reduce to.
I'm not quite how to do this. I know the solution is fairly simple. I know I can somehow represent $L'$ in terms of $L_1$ and $L_2$. Then I need to create a computable function that maps $L_1$ to $L'$ and either use the same ... |
Problem Statement :
You are situated in an N dimensional grid at position (x1,x2,...,xN). The dimensions of the grid are (D1,D2,...DN). In one step, you can walk one step ahead or behind in any one of the N dimensions. (So there are always 2×N possible different moves). In how many ways can you take M steps such that y... |
I need to find a Hamiltonian cycle in a directed graph using propositional logic, and to solve it by sat solver. So after I couldn't find a working solution, I found a paper that describes how to construct a CNF formula to find an Hamiltonian path:
Xi,j - node j is in position i in the path
List of constraints:
Each n... |
Model: Consider an undirected, weighted, complete graph $G = (V, E = V \times V, w: E \to \mathbb{N}^{+}, r: V \to \mathbb{N}^{+}, d: V \to \mathbb{N}^{+})$. $s \in V$ is a source vertex.
$G$ describes a transportation network, where $V$ represents places, $E$ represents roads connecting them, $w(e)$ represents the ti... |
Consider the following Python function:
def count_chars(list_of_strings):
chars = 0
for s in list_of_strings:
for c in s: # intentionally avoiding len() here for the sake of example
chars += 1;
return chars
Clearly this is a linear operation, since we iterate over every element/character once. But I'v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.