instruction stringlengths 35 29.1k |
|---|
Given context free grammar I use breadth first search and left most derivation rule to generate all possible words for a given language.
For example:
rules_1 = [('s', ''), ('s', '(s)s')]
depths = 0, nodes_on_current_level = 1, nodes = ['s']
depths = 1, nodes_on_current_level = 2, nodes = ['', '(s)s']
depths = 2... |
I am looking for an efficient algorithm to update a $N*N$ matrix, in which the coefficients represents the distance between $N$ number of points, every time that the coordinates of a point change in a 2D Cartesian plane.
Here an example:
There are 3 points in a Cartesian plane:
$a=(1,3)$
$b=(3,3)$
$c=(4,1)$
to calculat... |
So I'm learning about Myhill-Nerode relations and as an introduction, the book describes possible partitions for $\Sigma^*$. As an example, given a language $L$, a partition of $\Sigma^*$ would be $\{L, \overline{L}\}$.
Suppose there is a DFA for $L$, the book continues by creating the following notion: For a $q \in Q$... |
It seems to me that an array can be used as a stack or a queue and for various other things.
In my mind this makes an array a higher order abstraction compared to those other two.
Is this an acceptable argument or are there other preferred ways to determine order of abstraction that would invert my line of thought?
|
Given $n$ points in $\mathbb{R}$ each colored with one of following three colors
$$C=\{c_1, c_2, c_3\}.$$
In polynomial time, Choose the minimum number of intervals of length $1$ each containing some of $n$ points such that from each color, $c_i$ ($1 \leq i \leq 3$), there is at least one point in one of chosen interva... |
Define the halting problem as $\{\langle M, w\rangle: \text{$M$ is a TM that halts on $w$}\}$. It is undecidable, but recognizable, with a naive recognizer that simulates $M$ on $w$. In a certain sense, it is a "linear"-time algorithm, not in the length of the input of course, but in the "execution complexity" of $M$ r... |
My understanding is that a programming language is generally paradigm (functional, procedural, OOP) independent: we can code using different paradigms in some language. However, some languages, like Java, seem to require the developer to code only in OOP. And the language C does not even support OOP.
In regards to Pyth... |
During the fetch stage of the fetch-execute cycle, why are the contents of the cell whose address is in the MA (memory address register) placed in MB (memory buffer) then copied to IR (instruction register), rather than placing the contents of address of MA directly in the IR?
|
I am trying to implement the "DWR algorithm" described in Fig. 2 of This Paper (in order to get a program that reduces a planar graph to K2 using solely loop removal, leaf removal, "contraction" of nodes of deg 2, removal of redundant parallel edges, and, most importantly, delta-wye and wye-delta transformations)
The a... |
The maximum weighted matching problem (https://en.wikipedia.org/wiki/Maximum_weight_matching) finds a matching in a weighted graph that has maximum sum of weights. I was wondering if there are any existing approaches to find a matching that maximizes the minimum weight? (Can't seem to find any similar references on thi... |
As title, I'm trying to implement a text editor with the rope data structure, which is backed by binary search tree.
Since I want it to have persistent undos, the underlaying data structure should also be persistent.
I know that there is an candidate like randomized immutable treap, I'd like to know if there are other ... |
I have been looking around for a few days trying to find a clear and concise description of how, at a technical/implementation level, how distributed joins work, but haven't found much. The best so far is in Track Join: Distributed Joins with Minimal Network Traffic. In this though they seem to suggest that every joine... |
Could someone please explain the expression for division in tuple relational calculus in words? I do not understand how the multiple operators (existential and universal quantifiers) are to be interpreted.
My question is almost the same as Division in tuple relational calculus but there is no response to this.
|
Consider that
\begin{align}
\Gamma(n+1) = n!
\end{align}
for any integers. I then got the following two questions:
What is the largest value of $n$ for which $Γ(n+1)$ and $n!$ can be exactly represented by a double-precision floating-point number?
What is the largest value of $n$ for which $Γ(n+1)$ and $n!$ can be ap... |
For a given context-free grammar (CFG) you can always construct a pushdown automaton PDA (and vice-versa). This pushdown automaton is possibly non-deterministic, since for a non-terminal $X$ in the CFG, there might be multiple rules of the form $X \rightarrow \gamma$.
The book I am using says that this looks like it co... |
I am trying to describe a novel type of DAG's construction algorithm. The directed edges of the graph corresponds to a partial ordering: i.e. any directed edge $e$ spanning from $f$ to $t$ also observes: $f \preceq t$.
Q: How can I precisely define the main task of edge construction: that is finding the node $f$ for a ... |
I want to prove to a verifier that I know the passcode of a system. The system contains data/information of the verifier of which is only contained with this system. Since I know the passcode to the system, I retrieve data relating to the verifier and tell the verifier of this information. He acknowledge the informatio... |
This is a question I got for an assignment, and I have been stuck on it for the past few days.
Prove that
$\Theta(n)+\Theta(n-1) = \Theta(n)$
Does it follow that $\Theta(n) = \Theta(n)-\Theta(n-1)$
I was able to prove the first part but I am getting stuck in the second part. If someone could help me out with this I wou... |
What would be a pseudocode of try-catch pattern, common in generally all programming languages?
Perhaps the following?
Try X,
If you catch Y (success) than continue,
If you didn't catch Y (bug),
Either,
Do nothing || throw an exception (error)
|
MAX-QP problem (quadratic programming on boolean cube) statement:
Given symmetrical matrix $A$ with 0 on diagonal
$$A = (a_{ij}) : A^T = A, a_{ii} = 0$$
Find maximum $x^TAx$ where $x \in \{0, 1\}^n$, in other words
$$\max \sum_{ij}a_{ij}x_ix_j$$
Note that this problem is similar to the max-cut ploblem with no limitat... |
I've seen questions about how an NTM could simulate a DTM and this seems pretty straightforward to me. However, my text book says you can also simulate an NTM using a DTM.
How would this work? I'm especially curious on how to define the transitions, since in the DTM, each transition would have to be deterministic.
|
There is a lemma in our textbook that asks us to prove the following:
If $L_1 \leq_m L_2$, and $L_2$ is decidable, then $L_1$ is decidable
I tried proving this by saying that if $L_1 \leq_m L_2$, there is a function $f$ such that $f(L_1) \subseteq L_2$. But I know for a fact that a subset of a decidable language is not... |
Are turing machines with an infinite program tape that is completely random, or another example is a Game of Life simulation on an infinite randomly initialized grid, still turing machines, so to speak?
edit: if this is the wrong place to ask this(?) remove it
|
If we have input of size $N=13$, which represents array that has 13 element. We need in general $O(N\log{N})$ memory to store all intervals. We see that number of intervals we need in terms of power of $2^p$ is 3, so intervals is $p=3$.
Problem: I am not sure though why the space we need to store intervals then is $O(1... |
In "The Lambda Calculus - Its Syntax and Semantics" by H.P. Barendregt (WorldCat) the term "term modulo" is used, E.g.
The principal object of study in the λ-calculus is the set of lambda terms modulo convertibility. (p. 22)
Terms modulo a change of bound variables (p. 25)
What does "terms modulo" mean?
|
In "The Lambda Calculus - Its Syntax and Semantics" by H.P. Barendregt (WorldCat) is this statement, the first sentence of chapter 2 after the introduction chapter, so in a way this sets the tone of the book and is useful to understand.
The principal object of study in the λ-calculus is the set of lambda terms modulo ... |
In a two-level virtual memory, the memory access time for main memory, $t_M=10^{−8}$ sec, and the memory access time for the secondary memory, $t_D=10^{−3}$ sec. What must be the hit ratio, $H$ such that the access efficiency is within $80$ percent of its maximum value?
$\tag {GATE-CS-1990}$
I came across the problem... |
I have a large network of 10,000 nodes and I am trying to identify subgraphs which are clique-like, in that they share many connections. I don't a priori know how many subgraphs fit this criteria.
To solve this task, I have been trying to use the highly connected subgraph (HCS) algorithm for this, but it seems to run v... |
How do COVID-19 Vaccination ID verifications work? How do they automatically verify that the COVID-19 Vaccination ID is not faked?
|
Using the basic algorithm to calculate post dominators I run into trouble when working with a CFG containing an infinite loop (i.e., not terminating).
The algorithm:
// post dominator of the start node is the start itself
PDom(n0) = {n0}
// for all other nodes, set all nodes as the post dominators
for each n in N - ... |
I'm looking for an operating system (commercial opensorce or any) which can freeze any currently running application (video/audio playback, a game etc.).
While the app is frozen the OS must be able to show some windows (maybe some information to the user) or play some sound etc. In other words the apps are frozen and y... |
The wikipedia entry for disjoint set data structure includes the statement (in the "Applications" section)
Note that the implementation as disjoint-set forests does not allow
the deletion of edges, even without path compression or the rank
heuristic.
Is the article trying to say that a deletion is not possible with a... |
I am confused by the following claim:
Let $T$ be a (decider, single-tape) Turing machine with the property that for every input, every cell on its tape is accessed at most $10$ times. Then there is a (nondeterministic) finite automaton equivalent to $T$.
The assumption says that there are only finitely many possible ... |
I am trying to reduce between a solution problem and a decision version of the same problem.
The problem is the orthogonality problem. Given $2$ sets $L$ and $R$, whose size each is $n$ vectors over $\mathbb{N}\cup\left\{ 0 \right\}$, each vector with dimension $k$ (assuming $k<<n$), I want to:
A) Find whether a pair ... |
"The Ali Baba cave" example of ZKP is pictured below. There is no need for a probabilistic ZKP protocol to prove to the verifier of the statement (that the prover has the key to the door). It can be proved deterministically without the prover revealing any knowledge/information.
Assume that both the verifier and prover... |
I've been looking at algorithms for finding the diameter of a convex polygon, and while I like the Shamos' algorithm using antipodal points which is general and applicable to various other problems, I thought I would try and find my own solution/proof that's focused only on the diameter. I haven't taken a look at a pro... |
I recently heard about the concept of zero-knowledge proof. However, I still do not get how it is possible to make it a solution to some real-world problems. One thing I heard is that zero-knowledge proof can be utilized in Elections. But my question is what is the use, or how can we implement zero-knowledge proof syst... |
Background
I have some code, I have written.
The time complexity for building the Graph with Nodes + connections is calculated to be $O(N^2)$, even though in the constructor there is first, one $O(N^2)$ for creating the graph, and the second nested-for loop is for building the edges between nodes i.e. connections. Agai... |
TL;DR Is there a "standard" way to represent a float scaled to a particular range, such that we get maximum precision for the given bit depth, within that range?
I'll start with my general question, and because StackExchange likes me to be specific about what I am trying to do, I shall end with specifics.
General Quest... |
Consider the family of circuits $\{C_n\}_{n\in \mathbb{N}}$ that are big enough to compute every Boolean function for $n$ variables. We can label the nodes in order starting at the inputs and working down the layers, so that $2^{2^n}$ refers to the last, deepest node in the circuit.
A decidable problem corresponds to a... |
Define
Partition to consist of all tuples $x_1,\ldots,x_n$ which can be divided to two groups in which the sums of the two groups are equal.
Is there a proof that there isn't an additive approximation algorithm to the problem?
Where $c$ is the minimal distance between the groups.
|
When proving the bound on a summation in the Analysis of Algorithms when proving the bound also applies to $n+1$ the following inequalities are derived by the induction hypothesis:
$$\sum^{n}_{k=0}3^k + 3^{n+1} \leq c3^n + 3^{n+1}
= \left(\frac{1}{3} + \frac{1}{c}\right)c3^{n+1} \leq c3^{n+1}$$
I don't quite understand... |
I am trying to generate partitions of networks to evaluate clustering algorithms. I know that generating all partitions is infeasible (since they grow with Stirling number of the second kind which get big very quickly). I would like to restrict this to partitions that have a minimum size since these are the ones I care... |
I can't figure this out; is $2^{n^2}=O(n!)$ or is it the other way around? Any help is appreciated!
|
I am trying to build an imperative programming language with a type system that will allow for proofs. I just found kind lang, which implements all the ideas that I have been meaning to use (plus more), but it is a functional language. An older rendition of the project was Formality in JavaScript, or probably earlier, ... |
I am designing an automaton which determines whether a binary number is divisible by 3:
$$ \{x \in \{0, 1\}^* \mid \text{$x$ represents a multiple of three in binary} \} $$
0
1
0F
0
1
1
2
0
2
1
2
This is the transition state diagram of the automaton, whose states are $0,1,2$; the states are drawn from... |
Let A be a nonempty alphabet, $X ⊆ A^*$ a decidable set, and $Y ⊆ A^*$
be a semi-decidable set. We assume that $Y ⊆ X$ and that $X \setminus Y ⊆ A^*$ is semi-decidable. Show that then the set Y ⊆ A∗ is decidable.
I am looking for some ideas where to start this problem. I think we need 2 TM's which check each input sim... |
I am considering geometric graphs $G=(V,E)$ where $V$ is a set of points in $\mathbb{R}^2$ and the edges are straight line segments between vertices. See the image:
Now I want to calculate all pairs of edges that cross, i.e. intersect in their interior. I want to do this as efficient as possible. I could brute-force i... |
What is the logic behind using a loop invariant proof for proving the correctness of an algorithm? How is it proved that using the loop invariant proof indeed proves the correctness of a loop?
|
For a state of the art compiler, can they successfully do type inference on all of these cases, or are there some in which they can't? If there is a place which collects a bunch of test cases which a compiler should handle, please let me know, that would be wonderfully useful in building a compiler, and would also prob... |
My question is about the algorithm in the article Linear-Time Self Attention with Codeword Histogram for Efficient Recommendation, as described in the picture below.
It is written at beginning section 3.1 in the article $X$ is a matrix but It is seen the figure 2 a sequence of codeword indices represented as a vector ... |
I am a final semester pure math undergrad, and I became interested in Linear Cellular Automatas.I became interested after reading Klaus Sutner's article. In the article, a little abstract algebra is used, linear mappings, a vector space over $F_2$, I did use a bit of group theory to prove tiny things here and there.
Qu... |
I want to study operating systems in depth, in particular windows, linux and android OS. What is the best way to get started?
|
The Word type (in kind lang) looks like this:
type Word ~ (size: Nat) {
e ~ (size = Nat.zero),
o<size: Nat>(pred: Word(size)) ~ (size = Nat.succ(size)),
i<size: Nat>(pred: Word(size)) ~ (size = Nat.succ(size)),
}
The syntax is defined here.
All it says is:
type Name (A: Par0, B: Par... |
This problem is based off of the following problem on stack overflow: https://stackoverflow.com/questions/64797299/greedy-algorithm-to-maximize-score. The second answer is incorrect because the answer $[3,4,1,6]$ does not satisfy the constraint that games must be played at or before their deadline, and game $1$ is pl... |
Can we solve this recurrence relation : $T_n = \exp(T_{n-1})$ ?
Thanks!
|
What follows is a pretty complicated object (in an object-oriented, imperative, typed language), which I would like to create a type for with some sort of type annotations. I am open to how it is done, just trying to see how to get fine-grained in the types we specify, as they are relations between far-reaching parts o... |
This exercise come from Sipser (1.68).
In essence, show that if $A$ is regular, then $CUT(A) := \{yxz | xyz \in A\}$ is regular. I've managed to show that $B = \{yx | xyz \in A\}$ is regular. Furthermore, I've shown that $SUFFIX(A) = \{z | xz \in A\}$ is regular. My idea was to then say that $CUT(A)$ is precisely the c... |
I have used different machine learning algorithms to predict solar panels' power output. There are ten independent features for weather data.
In all models, I set time as an index and have used the following rule for splitting the data :
X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.18, random_s... |
I need a book recommendation for graph theory which supposes background in set theory. I want to cover those questions first as graph theory is part of combinatorics. Can you recommend me a book which is beginner-friendly without going much into combinatorics?
I heard about Harris and West but these books use too much ... |
I want to generate all solutions of $x_1+x_2+\ldots+x_{100}=6$ where $x_i$s are non-negative integers. Finding the number of such solutions is not difficult. But is there any easy way to get all solutions?
|
I am relatively new to writing proofs and I am stuck trying to prove that if $x$ ~ $y$, then $x^R$ ~ $y^R$. Any help would be appreciated!
|
I haven't been able to track down if there is a generally accepted practice for assigning a Big O value when dealing with functions of unknown runtime.
Given the following pseudocode, with two functions that operate in an unknown time, is it typical to assume the processing is constant time, or would it be more correct... |
I am trying to create a calculator in excel for use in Minecraft later and I was wondering if the was any way to create and how I would create a base 10 to base 2 converter with only logic gates. if you need the .xlsx file for reference I will put it in the comments.
|
In the paper by Cho et.al., section 2.3 details the equations for the modified LSTM cell in RNN used in the paper's implementation. The equation in question is :
Here, the output of the reset gate (r) is element wise multiplied with the previous hidden state h<t-1>, and then matrix multiplied with the U matrix.
Later ... |
Formatting code or things like TeX have some interesting problems. For instance in auto-formatting code you want to use up as much line space as possible but not go over a certain limit if possible. This turns out to be a little bit less trivial than it sounds but has been worked on (see here and here) and very nice in... |
I was able to understand the problem of at most k edges and exactly k edges but I am not able to wrap my head around how do I solve the problem of getting shortest paths with at least k edges. You can traverse same edge twice until you reach the minimum required number of edges. An example of implementation is going fr... |
On modern architectures, random number generators get seeded by the current system time as a source of randomness, which is nice because it is kind of unpredictable when a process will switch to the current process. When this timer is in milliseconds or nanoseconds for example, you will get a good random number seed. ... |
For example, the following grammar will never stop deriving a complete sentence:
S -> A b
A -> a A
Some other CFGs can derive a complete sentence, but it still is possible to wind up in a infinite loop, e.g.
S -> A b | b
A -> a A
Currently I am writing a LR parser generator. If it doesn't check if the input CFG is in... |
For our web application we are maintaining some data, pertaining to our subscribers, on our server. Some of this data is sensitive and we would like to implement some "security measures" for this data. One is encryption, and we know how to do that. The other is non-repudiation of the content, and we don't know how t... |
Consider the set of all possible two-to-one functions that map inputs from $\{0, 1\}^{n}$ (domain) to outputs in $\{0, 1\}^{m}$ (co-domain) and let $m > n$.
If I pick a function randomly from this set, what is the probability that it can be computed by a Boolean circuit of size $\text{poly}(m)$?
Note that while the co-... |
I tried to solve the recurrence $T\left(n\right)=\sqrt{n}\cdot T\left(\sqrt{n}\right)+c\log n$ using the Master Theorem. I tried the following way:
$n = 2^k$
$2^{\frac{2}{k}}\cdot T\left(2^k\right)+\log2^k$
$2^{\frac{2}{k}}\cdot T\left(2^k\right)+k$
At that point i'm stuck and not sure how to handle the $2^{\frac{2}{k... |
Let B be an undirected tree with |V| nodes given as adjacency list. I want to develop a greedy algorithm using pseudo code to find a maximal matching in runtime O(|V|).
I understand that the solution is:
Find all leaves. For each leaf if the parent edge has not been seen by another leaf, mark the edge to its parent as ... |
In "Types and Programming Languages" by Benjamin C. Pierce (WorldCat)
5.3.2 Definition: The set of free variables of a term t, written FV(t), is defined as follows:
FV(x) = {x}
FV(λx.t₁) = FV(t₁) \ {x}
FV(t₁ t₂) = FV(t₁) ∪ FV(t₂)
\ is relative complement
Based on above definition of free variables my understa... |
I am trying to traverse through all uint64_t with k 1s. Then I find that if x and y are circular shifts of each other, they will output the same result. So I'm trying to optimize my code.
The problem is I don't know how to exactly traverse through the set of numbers that has exactly k 1s, and also unique under circular... |
As far as I know, Immerman showed that first-order logics extended with transitive closure (TC) captures (non deterministic) logspace (over ordered domains) [1]. That is, any database query that can be computed with $k*log(n)$ space, can be defined through a first-order logic query with TC. To show so, Immerman emulate... |
I am trying to find the runtime of:
$T\left(n\right)\:=\:n\:+\:\sum _{i=1}^{n-1}\left(T\left(i\right)\right)$
$T(1)= 1$
What is the way to solve this kind of problems?
|
So, we have the tables:
Person (SIN, Name, Address, Owner_id)
Owner (Owner_id)
Vehicle (Vehicle_id, Plate_number)
Car (Vehicle_id, Cmodel, Cyear)
Truck (Vehicle_id, Tmodel, Tyear)
Owns (Owner_id, Vehicle_id)
How do I format a relational algebra statement so that I get the number of people who only own cars (not truck... |
For some reason—at least when classes are involved (which I don't know the reason for yet)—in IPv4 the number of host addresses available per network is given by $2^\textrm{host bits} - 2$. Why don't we have $2^\textrm{host bits}$ host addresses available?
|
Statement
Consider the following modified node structure for the linked list:
struct Node {
int value;
Node* next;
Node* random;
}
The next field points to the next element in the list. The random field points to some other node, which is guaranteed to be in the same list. E.g. (black arrows denote next, purp... |
Similar to this question but items don't have value $v$.
Max weight $W$, every item has weight $w$, must add exactly $L$ items to the knapsack, need to get max weight as possible.
|
I want to implement all of the data structures from scratch but testing them is not an easy task. So, I wanted to ask if any of you know repository containing Class, Method Stubs for popular data structures and also their tests. Especially, unit tests are of a great importance.
Thanks in advance
|
Let me put it this way. I have two arrays A and B. Array A contains manufacturing dates of cars, and Array B contains corresponding car model names. A and B are in correspondence. Now I want to sort array A but at the same time the coordination of both arrays should not break. Whats the best way to do that?
Example:
Ar... |
I am looking to write a program analysis for Java programs that tracks assignments and is able to discern:
whether a class field (static or not) is read and where the read originated
whether a class field (static or not) is written and where the write originated
properties of the value that is written: 1) is it a scal... |
I have a converter between two context-free grammars which are both describing the same language but one uses infixes other than prefixes, has different symbols and sometimes switches order of nonterminals. It's a converter in a sense that it takes an expression in one grammar and outputs its equivalent counterpart in ... |
You are given a team's win probability for each game on their schedule in the form P[1..n] where P[i] is the likelihood they win game i. Give a dynamic programming algorithm that returns the most likely number of wins, and the probability of this outcome, using O(n) space.
For example, if n = 2 and P = [0.4, 0.2], the ... |
I am trying to solve a recurrence relationship as follows:
T(n)=T(n^1/2)+O(loglogn)
I can solve the T(n^1/2) part quite easily, but I am completely lost as to what to do with an O(loglogn). I cant use the masters theorem since loglogn cannot be expressed in the form of n^x and using trees, I don't believe I can just dr... |
I want to prove this:
For any binary tree T, let f(T) denote the sum of the depths of all
of the leaves of T. (The root is at depth 0, the children of the root are at depth 1, the
grandchildren of the root are at depth 2, etc)
Prove that f(T) = Ω(l log l) for any l-leaf binary tree T.
Any suggestions?
|
Given I have two sets of objects $A =\{a, b, c\}$ and $B = \{a, b, c, a\}$
Based on the set equality, I want the fingerprint of these sets to be the same $F(A) = F(B)$.
Additionally I want to be able merge fingerprints in order to calculate the fingerprint of the union. $F(\{a,b\} \cup \{c,a\}) = Merge(F(\{a,b\}), F(\... |
A sports league wants to use an algorithm to decide when & where each team will be playing another team in the league. Each team will play the other team in either the first team's home city or the second team's home city. For example, if this is the National (American) Football League, the Houston Texans would play th... |
Let $F$ be a field. Suppose we have a machine $T$ that works with words that are elements of $F$, for exmaple $F = \Bbb{Z}/2, \Bbb{Q}$ (using arbitrary precision arithmetic), or $\Bbb{Z}/p$ for a prime $p$. Empty memory is represented by the vector space $F^0 := 0$. If an algorithm addresses $n$ memory slots, that w... |
I'm currently taking my algorithms class, and I learnt that Big theta is defined as follows:
$f(n) = \Theta(g(n))$ if there exist constants $c_1, c_2, n_0 > 0$ such that $0 ≤ c_1g(n) ≤ f(n) ≤ c_2g(n)$ for all $n ≥ n_0$.
So if our $f(n)$ and $g(n)$ are of the same order, say $n$ and $2n$, we can easily find a constant... |
This is what I got from another forum, but honestly doesn't make much sense to me.
Time complexity for a single tree doesn't make a lot of sense, since the function in the big O notation might be nowhere near the actual computation time. Time complexity is all about how the algorithm scales as the inputs get larger. ... |
In a market there are N different items where each item is unique and identified by id (1-N). There are also K buyers with names (1-K). Each buyer has 2 items that they want to buy (A, B), where A is the id of the first item and B is the id of the second item. Each buyer will either buy one or no item. If the first ite... |
I have $k$ sets of similar sizes, that cover a universe $U$.
e.g. for $k=3$ and $U = \{1, 2, 3, 4, 5, 6\}$:
$S_0 = \{1, 2, 4\}$
$S_1 = \{2, 3, 4\}$
$S_2 = \{4, 5, 6\}$
I have another larger set $C$ guaranteed to be subset of $U$.
$C \subseteq \bigcup\limits_{i=0}^{k} s_{i}$.
e.g. $C = \{1, 2, 3, 4, 5\}$
I want to be ab... |
I want to prove that the following problem is NP-Complete.
Input: Set $S = \{s_1, \dots, s_n \}$, set $T \subset S \times S$, that contains ordered pairs $(s_i, s_j) : s_i \neq s_j$, and an integer $k \geq 1$.
Output: Is there a permutation $p:\{1, \dots, n\} \rightarrow \{1, \dots, n\}$ for the elements of $S$, so th... |
I have just started my masters without any substantial experience in programming and I am struggling to understand certain concepts.
I have been given the following language $$L = \{a^i b^j c^k \mid i, j, k ≥ 0, \text{ if } i = 1 \text{ then } j = k\}.$$
However, I am struggling to find a way to prove that it is not re... |
Given two bitmap images (two arbitrarily sized two-dimensional matrices of integer values ranging from 0 to some maximum number), I want to determine their maximum overlaps.
An overlap is a relative positioning of the images (a translation of the second image) producing a nonempty intersection on which both images are ... |
I want to show that a subproblem of the known, $\mathcal {NP}$-Complete, Sparse Subgraph problem is also $\mathcal {NP}$-Complete.
Sparse Subgraph problem:
Input: Undirected graph $G(V,E)$, two integers $k, l$.
Output: Is there a subset $S \subseteq V$, where $|S| \geq k$, such that there are at most $l$ edges between... |
I'm writing a web app that requires a component that let's the user input a piece of text thats automatically formatted based on something the client calls "macros". These macros have a very specific syntax. Examples:
"{{ greetings_alternatives}}, my name is {{ names_alternatives|cap }}" -In this example, {{ greetings... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.