instruction stringlengths 35 11.4k |
|---|
I am confused about the definition of sub graph isomorphism, wikipedia says that the subgraph isomorphism problem is a computational task in which two graphs $G$ and $H$ are given as input, and one must determine whether $G$ contains a subgraph that is isomorphic to $H$.
Is this the correct statement or is it whether $... |
I have a convex function of $n$ variables, $f(x_1,x_2,\dots,x_n)$ and need to find its minimizer. Are there algorithms that can retrieve the minimizer in an online fashion? i.e. solve for $x_1^{(opt)}$, $x_2^{(opt)}$ and so on in a sequential manner?
|
I want to calculate ϴ dependent on n for this algorithm:
for (k = n; k < c; k++){
j = 1;
while(j < n){
j++;
}
n is the parameter. c is a constant.
I calculated the amount of operations to (c-n)*(n-1). But now I don't now how to deal with c.
|
I had a question regarding CNF (Chomsky normal form) in formal language theory.
I noticed that a lot of authors (including my own professor, and the Wikipedia page for CNF) frown upon or don't allow the start symbol to be on the right hand side of the production. However, I just can't wrap my head around why this is so... |
How do i calculate the complexity of this algorithm at the best case and its complexity at the worst case and the average complexity by assuming that the probability that the element is in the list is 0≤p≤1 and that all sites are equal probability
|
I'm reading the Model Chekcing book of E. M. Clarke and in the chapter about µ-calculus there is an example formula
$$
f = \mu Z. ((q \mathrel{\mathrm{AND}} Y) \mathrel{\mathrm{OR}} \langle a \rangle Z)
$$
As the author has mentioned, here $Y$ is a free variable, and we need an association list to pair $Y$ with the cor... |
The term "concept drift" specifically relates to a model changing over time. However, a similar phenomenon may manifest in, e.g., spatial data, where a topographical model changes behavior at a land/water boundary. Another example may be in modeling the properties of a chemical substance, which change in behavior acr... |
Does $R(L_1\cdot L_2)=L_2\cdot L_1$?
Where $R$ is the reverse.
I can't think about counter example
|
Is there any algorithm to calculate maximum number of node splits that can occur in given number of insertions and highest branching order? Lets say I want to insert 10 elements to an empty B-tree with highest branching order of 3. Is there way to calculate the maximum number of splits that will occur?
|
I'm looking for a general reference cataloguing types of automata. Any introductory textbook will cover DFAs, NFAs, PDAs, and TMs, but there are countless more automata of practical or theoretical interest — linear bounded, embedded pushdown, nested stack, tagged finite, and so on. Online resources for these tend to be... |
I'm trying to prove the Connected Vertex Cover problem is NP-complete. That is given a graph $G=(V,E)$ and integer $k$, is there a subset $X$ of $V$ such that $|X|≤k$ and that for every edge $(u,v)\in E$ at least one of $u$ and $v$ are in $X$. Furthermore, the subgraph $G[X]$ induced by $X$ must be connected.
I know th... |
I am working on Minimum Dominating sets for bipartite graphs. There can be many minimum dominating sets of same size and I want vertex which is present in all of them. My approach for generating dominating sets is try all subsets of vertex and check if it is minimum dominating sets and then take the intersection of all... |
Lookup tables can convert a piece of computational time into space. I remember that it was a part of a complexity theory course, but I cannot recall how it's called in its terms. I know how to use lookup tables in code to increase performance of my applications, so I don't need a definition of it in common sense.
I wan... |
There is a set of 2D polylines, each polyline defined by an ordered array of vertices (each vertex is joined with the previous one by a line, if drawn). Together, when drawn, these polylines form one or more contours, but they can be fragmented (a single contour consisting of several polylines)
The task is to build ne... |
I would like to apply Hoare Logic to realistic, complex imperative programs that use while loops, if statements, functions, modules, etc. and have side effects (e.g. access the network). In order to get started with using Hoare Logic, I would like to see what it takes for this simple function:
function colorize(integer... |
My intuition is that 1) self-awareness (modeled through epistemic modal logics); 2) goal reasoning (e.g. https://www.aaai.org/ocs/index.php/AAAI/AAAI16/paper/view/12292) and 3) consciousness (e.g. Integrated Information Theory) are the necessary and sufficient features for agent to be truly autonomous. Especially - con... |
How can I show that the lower bound for getting a triangulation from a point set in the plane is $\Omega(n \log n)$?
I know that the lower bound for finding the convex hull for a point set is also $\Omega(n \log n)$. Is it valid to argue that since the convex hull is also part of the triangulation it can't be done fast... |
I have one or more second-order logic formulas that correct for some finity model. What operation can I perform on them, so that resault is also correct for some finity model?
Just conjunction is impossible, example:
$x$ has finity model, $\lnot x$ has finity model, but $x \wedge \lnot x$ has not finity model. Are ther... |
Let G be a connected graph, knowing that it has more than 9 vertex, Show that either its independence number is bigger-equal than 4 or its click number (the size of the biggest fully connected group) is bigger-equal than 3.
|
Given these 5 axioms of Hoare Logic:
\begin{array}{cl}
\frac{}{\{\phi([x \leftarrow E])\}\ x := E\ \{\phi(x)\}} & \mathtt{Assignment}\\\\
\frac{\{\phi\}\ P_1\ \{\eta\} \quad \{\eta\}\ P_2\ \{\psi\}}{\{\phi\}\ P_1; P_2\ \{\psi\}} & \mathtt{Sequencing}\\\\
\frac{\{\phi \land B\}\ P_1\ \{\psi\} \quad \{\phi \land \neg B\}... |
As an exercise in better understanding, I have been implementing the LTL to Generalized Büchi Automaton translation algorithm of Gerth, et al. (which is also discussed in Clarke, et al., Model Checking).
What I have ended up with seems incorrect, but also seems to accord with the discussion. Both of the presentations ... |
The terms "data", "information" and "knowledge" are quite interchangeably used in Computer Science. Strictly speaking, they do carry a very different meaning. I want to know their precise meanings and their context and usage.
According to my limited experience, data is simply "raw fact and figures" whereas information... |
Given this assertion in Hoare Logic:
\begin{align}
&\mathbf{\{p >= 0\}}\\
&s = 0 ; n = 1 ;\\
&\mathtt{while}\ (n <= p)\ \{\\
&\quad s = s + n ;\\
&\quad n = n + 1\\
&\}\\
&\mathbf{\{s == p * (p + 1) / 2\}}
\end{align}
How to prove this using the rules of Hoare Logic. I am not sure where to really begin, I only currentl... |
I have been trying to wrap my head around applying Hoare Logic and am running into the question of how Hoare triples are any different from (simply) a typed function.
That is, say you have a typed function $f : A \to B$. The initial state for the function is thus $A$, and the final state is $B$. Similarly, in Hoare Log... |
Considering a 2-tag system as defined by wikipedia, how do I identify the result of the computation?
|
I'm trying to generate all permutations of N numbers where any two permutations are different by at least K positions. I would just like a push in the right direction, the trivial method of memorizing every valid permutation and then just comparing at each step would be impractical for large values of N.
Example:
N=4, ... |
Suppose a binary tree with $n$ levels and exactly $2^n-1$ nodes.
The nodes are random and their value does not determine their position in the tree at all. This isn't demonstrated in the picture, because I couldn't find a better image to use.
The task is to find the path to a given node. Since the nodes are random, ... |
Let's assume that DFA $A$ over the alphabet $\Sigma$ and with states $Q$ is maximal if for every function $f\colon Q\rightarrow Q$ there exists such word $w \in \Sigma^{*}$, that $q \cdot w = f(q)$ for every state $q \in Q$. Let $L \subseteq \{a, b, c\}^{*}$ be a non-empty language recognized by a maximal automaton wit... |
Suppose one wants to uniformly sample a string $w$ of a given length over a finite alphabet, such $w$ satisfies a set of structural constraints (such as - "the third character has to be equal to the first character and the last character has to be equal to the second one").
The obvious method is to uniformly sample $w$... |
How should I compute the maximum absolute and relative error of the following IEEE-754 floating-point expression?
a.y + (x - a.x) * ((b.y - a.y) / (b.x - a.x))
Also, we assume, that
the optimizer leaves the expression in the specified form
the default rounding mode (round to nearest even)
|
Let say we have a Language $L = \{0^m1^n \mid m,n \geq 0 \land m \neq n \}$. If I want to use the pumping lemma to disprove that the language is regular or context-free, how do I choose the word in dependence of the number $n$? The problem is that I got an $m$ and an $n$ in the exponent and they cannot be equal. Can I ... |
This question is about a few sentence description of what a proof would look like (and technologies / logics involved) for a complex api call through many layers. Trying to get a sense of the techniques and key points to watch out for. I understand it would take a lot of work.
In learning about formal proof and verific... |
We know all optimisation problems can be converted to decision problems. Is that true for search problems, counting problems and function problems as well?
Description of the types of problems is given here:
Computational problem.
Edit: So, the comments suggest that I state more precisely what I mean. I'm not entirely ... |
I'm trying to build logical representation from dependency tree with python.
i created the tree with stanford parser.
How can I derive logical presentation from it using Lambda-calculus?
|
For Timed Automata, I found Figure 1 below. For Coloured Petri Nets I found Figure 2. Both are for "Reachability Graph Construction".
However, they don't describe where they got the states from (Figure 3), for generating the reachability graph. They assume you have "states" to generate a reachability graph, but I'm not... |
I have the following problem:
Given a set a of n positive integers, write a backtracking C function that prints out all the subsets of a such that the product of their elements is p. Use an array for implementation of the set. What is the time complexity?
I have already solved the problem, both the idea and the C cod... |
I am having trouble understanding a question related to Huffman Coding. We haven't studied it a lot, so I am not even sure how to start.
Given $n ≥ 2$ characters, with probabilities $p_{1} \geq p_{2} \geq ... \geq p_{n}$ Let $p_{i} = 2^{k_{i}}$ with $k_{i} \in \mathbb{N}$ and $\sum_{i=1}^{n} p_{i} = 1$
Show that $p_{n-... |
First of all, I saw many answers of this topic in Quora, Stackoverflow, and this site. But, I couldn't definitely understand the difference between dynamic loading and dynamic linking.
What I understood until now is this.
Dynamic loading : system library or other routine is loaded during run-time and it is not support... |
I am trying to prove an elementary thing, but it seems at some point you get down to atoms where you can't prove anything else. This is why I am wondering about proving $c = a + b$, it seems like an atom.
\begin{align}
\{a, b\}\\
c = a + b\\
\{a, b, c = a + b\}
\end{align}
This is my attempt at a Hoare assertion.... |
Isometric path (like geodesic) is yet another name for shortest path. An isometric path cover is a set $S$ of isometric paths such that every vertex $v ∈ V$ belongs to at least one isometric path of $S$. The isometric path cover problem is to find a minimum cardinality isometric path cover of $G$. Is the isometric path... |
Given a set $S$ of $n$ planar points, we know that the $|CH(S)| = 17$. How can I create an algorithm that computes $CH(S)$ in $O(n)$ time? Why is it really $O(n)$?
|
I am given set of points S. I need to find the count of four vertices (A, B, C, D) satsfying the equation AB + CD = BC + AD, morever, the vertices should be pairwise distinct.
Here, A, B, C, D denotes the vertices choosen from set S.
AB, BC, CD, AD denotes the distance between A and B, B and C, C and D, and A and D res... |
If I have a list of lists as below ,
[[1, 2], [3, 4], [1, 5], [2, 6], [4, 8], [5, 6], [6, 7],
[7, 8], [6, 10], [7, 11], [8, 12], [10, 11],
[10, 14], [12, 16], [14, 15], [15, 16]]
and
[[1, 2], [2, 3], [3, 4], [1, 5], [4, 8],
[6, 7], [5, 9], [6, 10], [7, 11], [8, 12],
[9, 13], [10, 11], [12, 16], [13, 14]... |
The following question is taken from Sipser:
Prove that $EQ_{\mathsf{DFA}}$ is decidable by testing the two DFAs on all strings up to a certain size. Calculate a size that works.
Here is the answer:
For any DFAs $A$ and $B$, $L(A) = L(B)$ if and only if $A$ and $B$ accept the same strings up to length $mn$, where $m... |
Given a set of points S and a triangle, what are the various reasons for which constructing and using the convex layers of S is not optimal for counting and listing the points inside the triangle?
|
We have an $x$-monotone path $\mathbb{P}$ in the input. We want to store the path $\mathbb{P}$ in a data structure such that we can answer this type of the query.
Given any circle $\mathbb{C}$ and any two indices $i$ and $j$ with $1 \leq i \leq j \leq n$, report the first point of the subpath $\pi [ p_{i}, p_{j} ]=(p_{... |
I know that the exact cover problem has a pseudopolynomial algorithm when the cover size is a given constant (as here: Is set cover still NP-complete if you have a given k?).
However, I am interested in approaches to solving a variant of Exact cover (or rather, twice-exact cover, that I asked about here: Solving a vari... |
So much software related to computer vision relies on AI and neural networks, I wonder some of the approaches which don't use those methods. How could some of the mainstays of computer vision (eg. recognition and identification) be achieved without "artificial" means?
I'm reading Vision by David Marr and it talks about... |
I saw "Rosser’s Theorem via Turing machines" at:
https://www.scottaaronson.com/blog/?p=710
The modified halting problem (Consistent Guessing Problem) CGP is used in the proof:
CGP(M) - accepts if M accepts on a blank tape
CGP(M) - rejects if M rejects on a blank tape
CGP(M) - either accepting or rejecting if M runs for... |
Is the following scenario theoretically possible, or provably impossible?
Alice generates a 1 GiB file with random bits and sends it to Bob. This file is a shared dictionary they call Q. Now, Alice and Bob starts sending each other new files with arbitrary entropy, each of them < 1 MiB, but they compress them with a cl... |
Where can I find a source for questions/problems with data structures (like questions about avl trees , rank-trees, 2-3 trees, heap) and algorithms?
I will be happy for a references in these topics (I tried to search it in google,but I don't find appropriate something).
|
I'm reading the paper "Dual of substitution is Redecoration".
And I'm struggling with understanding the usage of the word "not-well-founded cotrees".
what is a cotree compared to a tree ? I suspect it is a tree for which all relations are inverted, but it is just my assumption.
what it is to be "well-founded" for a tr... |
Question
Given a 32-bit cmpxchg operation as a primitive:
u32 cmpxchg32(u32* mem, u32 key, u32 old, u32 neo) {
// this function runs atomically
u32 found = mem[key];
if (found == old) {
mem[key] = neo;
}
return found;
}
Is it possible to implement the same function, for 64-bits?
What I've t... |
I have stumbled on this question:
Which of the following languages over the alphabet ${a,b,c,d}$ are context-free and which not ?
a) $L_{1} = \{wa^{3n+1}b^nw^{R} \mid w\in \{c,d\}^*,\ n>0\}$;
b) $L_{2} = \{a^{3n+1}wb^nw^{R} \mid w\in \{c,d\}^*,\ n>0\}$.
For a) I think this grammar solves it :
\begin{align*}
S&\to c... |
I have a path from node 1 to node n, which I can represent as a set:
S = {1, 2, ..., n-1, n}. I want to efficiently generate the set of all subpaths from 1 to n. For instance, for n=5, we have S={1,2,3,4,5}.
So all the subpaths are as follows:
{{1,2},{2,3},{3,4},{4,5},
{1,2},{2,3},{3,4,5},
{1,2},{2,3,4},{4,5},
{1,2... |
A quine is a program that outputs its own source code without taking in any input. An example would be this (taken from here)
public class Quine {
public static void main(String[] args) {
char quote = 34;
String[] code = {
"public class Quine {",
" public static void main(String[] args) {",
" ... |
I need to create an algorithm that is going to create a shakespearean sonnet for a specific theme. This theme should be generated out of twitter tweets that have some hashtag.
My current idea goes like
While training:
break up sonnets and other kinds of poems into words (or charachters, have not decided yet)
extract ... |
I asked a question earlier about Saving to the Database, which was very general and about the requirements for a proof when you go through many layers of non-verified systems such as the network and databases.
In this question I am wondering about a more middle-level proof, this time about transforming an object $f : A... |
I am working with a u-net, a variation of the more commonly known fully convolutional network for semantic segmentation. For training a u-net, I was given the suggestion that I should use a pre-trained network. But, I'm not quite sure how this makes sense.
My understanding is, in pre-training, we freeze the network up... |
This line from Wikipedia made me want to ask this question:
There is, however, no general procedure for determining whether an expression involving looping instructions will halt, even when humans are tasked with the inspection. The theoretical reason for this is the undecidability of the Halting Problem: there cannot... |
I'm very new to this so please bear with me.
I found this document describing the PFX language, a stack-oriented language where the instructions act on a stack and replace the arguments with the result.
The image is supposed to be the rules describing the logic of a PFX program, but being very new to logical symbols, I... |
Also, what's the difference between transforming a problem into another problem and doing a reduction? They sound synonymous to me. Thank you!
|
I'm reading Fischer et al.'s Impossibility of Distributed Consensus with One Faulty Process, and I don't quite follow 2 points:
The first is in the proof of Lemma 3, pg. 378:
Otherwise, $e$ was applied in reaching $E_i$, and so there exists $F_i ∈ \mathscr{D}$ from which $E_i$ is reachable.
Why does there exist $F_i ... |
I was thinking about the max-clique problem and the k-independent set problem. You can show that k-independent set is reducible to max-clique easily and you can show that max-clique is reducible to k-independent set (with a simple for loop). And k-independent set is NPC, so wouldn't that mean max-clique is also NPC, bu... |
is the string epsilon(empty string) accepted by this NFA ?
|
I have stumbled across these 2 problems
$L_1= \{\alpha \mid w \in \{a,b\}^* | \alpha $ has exactly 2 b's$\} $ ,prove that $L =\{ \alpha^n | \alpha ∈ L_1 ,n \ge 0 \}$ is not context free
Given : $P= \{\alpha \mid w \in \{a,b,c\}^* | \alpha $ is palindrom with even length $\} $
and $L_2= \{\beta b^n| b$ ∈ $P^n$ a... |
I have a a data set with 2598960 elements of of unsigned integers of (at most) 52-bit length. The data set has a property that exactly 5 bits set.
This is only 1 data sets – I have similar data sets of integers with exactly 6, 7 and 9 bits set.
Given this peculiar property of the data set, is there a way I can create a... |
I am trying to do a dot product of two vectors of each 128 dimension. I am just looping each member and calculating the sum.
public Double dotProduct(List<Double> v, List<Double> u) {
Double dotProduct = 0;
for (int i = 0; i < 128; i++) {
dotProduct += v.get(i) * u.get(i);
}
return dotProduct;
}... |
Input: An array $a$ of integers $[a_{1}, \cdots, a_{n}]$, and a positive integer $k$.
Output: The the top-k products of pairs in $a$.
Example: $a = [7,6,5,4,3,2,1],k=3$ , output $(42,35,30)$, with corresponding pairs $(7,6),(7,5),(6,5)$.
A naive solution would can be done in $O(k^{2}\log{k} + n\log{n})$, which sort the... |
This is the pseudocode on wikipedia for Hoare's partitioning scheme:
algorithm partition(A, lo, hi) is
pivot := A[lo]
i := lo - 1
j := hi + 1
loop forever
do
i := i + 1
while A[i] < pivot //Question here
do
j := j - 1
while A[j] > pivot
... |
In general, the idea for simulation a turingmachine using a PDA with two stacks, is to use one stack representing the already read input and the second stack representing the unread part of the input.
To do so we need to read the complete input into one of the stacks.
If we use a nondeterministic PDA we are able to re... |
Short story
I am currently trying to implement LPA* in an existing navigation system and find the algorithm seems to loop forever, expanding the same vertices over and over again. I am wondering what is causing this to happen, and what I can do to rectify this.
Long story
The navigation system uses Dijkstra so far. As ... |
I understand the following (correct me if I'm wrong):
Statements
Luma as the weighted sum of RGB gamma corrected components, but luminance is the weighted sum of RGB linear components.
The gamma correction has two forms: gamma compression and expansion. When we want to encode luminance into imaging systems, we turn it... |
Can someone explain how do we find these parity bit errors?
|
Let $M$ be a one-band TM and $w$ a word. We say that M tries to move the head over the left margin of the band if, while the head is in the leftmost position of $w$, the TM $M$ tries to move to the left.
Show that the language
$ LEFT_{TM} = \{<M,w> | $ M is a TM of the type above $\}$
is not decidable.
How can I show t... |
Suppose that we are given a list of non-zero integers $(a_1,...,a_n)$ and we want to decide whether there exist $(x_1,...,x_n)$ such that
$x_1a_1 + x_2a_2 + ... + x_na_n = 0$,
$x_i$ $\in$ $\{-1,0,1\}$, with at least one $x_i \neq$ 0.
Note that this is not the same as PARTITION, where the restriction $x_i \in \{-1,1\}$ ... |
Is there an algorithm that, given an undirected graph, finds an independent set of size n (where n is less than or equal to the total number of vertices)?
|
In multi-armed bandit problem, we have a set of $K$ arms. In each round $t$, a bandit selects an arm $k$ and receives a reward $r_{kt}$. The objective is to maximize the rewards after $T$ rounds.
My question: Does selecting the same arm in two different rounds leads to the same reward? Or the rewards are completely dif... |
I found the toom-cook algorithm here: http://www.cs.cmu.edu/~ab/Desktop/15-211%20Archive/res00037/Multiplication_1_print.pdf
and have been trying to chase down proof of it being correct, but can't find anything. Does anyone know how to go about proving the algorithm? I was thinking induction but I can't even figure out... |
The question and its answer is given below:
Let $S = \{ \langle M \rangle \mid \text{$M$ is a $\textsf{DFA}$ that accepts $w^{\mathcal{R}}$ whenever it accepts $w$}\}$. Show that $S$ is decidable.
Answer:
For any language $A$, let $A^{\mathcal{R}} = \{w^{\mathcal{R}} \mid w \in A\}$. If $\langle M \rangle \in S$, then... |
In knapsack problem, we have some items with some values and weights. We also have a knapsack with a specific capacity, and we intend to fill the knapsack with these items. The main objective of this problem is to maximize the value of items in the knapsack.
Knapsack can contain maximum 11 kg items
item1: value(1) wei... |
I am implementing the multiphase level Chan Vese algorithm. I am using IPOL document as reference (http://www.ipol.im/pub/art/2012/g-cv/article.pdf)
Everything is clear for me, except the stopping criteria: In one level set, the method is terminated by calculating the difference between phi(n+1) and phi(n), and stop if... |
Why are the words in a cache line adjacent to one another?
Does this arrangement improve reading/writing performance or are there other reasons to justify this choice?
|
We can compute Fibonacci numbers by means of dynamic programming approach. If we do not store intermediate solutions, we cannot use them for future necessities. In this case, asymptotic complexity reaches exponential time.
f(5) -> 2^0
/ \
/ \
f(4) f(3) -> 2... |
I am looking for a direct proof (i.e. without going through ABPs) that if $f(\bar{x})$ has an arithmetic formula of size $s$ then it is a projection of an $O(s)\times O(s)$ determinant.
It seems possible using induction on $s$.
The basis, when $s=1,2,3$ is trivial.
Suppose we proved it for size $s$ formulas and let $f$... |
Input: Given a bitset $b$, which is is an array of 0s and 1s, of length $L$, and a positive integer $k$.
Output: the total number of 1s in the first $k$ position of $b$.
Obviously it can be done in $O(k)$, is there any more efficient way in C++ such as $O(\frac{k}{W})$, where $W$ is the word size of the machine? Note t... |
There are many different computational models, e.g. Turing machines, register machines, lambda calculus, etc.
I am wondering if there exists an axiomatization of computation, that abstracts away from the specifically constructed computational model.
I.e. is there a more general theory about computation that deals wit... |
Note: I know the numbers are arbitrary, but this problem about this size has practical implications. It is an applied algorithm problem.
Suppose you have 200 bins. Each bin would be very happy to have the integer sequence: 1, 2, 3, 4, 5, 6, 7, 8, 9. And the algorithm would be very happy if all bins get that.
The algori... |
Suppose that we are given $f_1(x),...,f_n(x) \in \mathbb{Z}[x]$. Decide whether there exist $a_1,...,a_n \in \mathbb{Z}$ such that
$\sum_{i=1}^{n} a_if_i(x) = p(x)^2 $
$p(x) \in \mathbb{Z}[x]$.
In other words, decide whether there are integer coefficients such that a linear combination of the given polynomials is a ... |
Multiple resources, such as Wikipedia, state that if you have an $m$-bit Bloom filter with $n$ elements inserted, then the optimal number $k$ of hash functions to use is
$k = \frac{m}{n} \ln 2$
This is very counterintuitive. If $m$ is the number of bits in the filter, then as you increase $m$, why would the optimal num... |
I am writing a small RPN calculator that works on some stacks concurrently. For example, if I have two functions:
add-int(a: int, b: int): a b +
add-float(a: float, b: float): a b +
and I have two stacks with the following:
Int [1 2 3]
Float [4.0 5.5]
I can just do:
add-int add-float
and the new stacks will be:
Int ... |
The algorithm I'm referring to is one of the most fundamental primality checks: For a number, $n$, check if it is divisible by some odd number, $k$, less than or equal to $\sqrt{n}$. Assume $n$ is a fixed size and that all basic arithmetic operations (add, subtract, multiply, divide, remainder) run in $O(1)$. I don't s... |
I was reading up on the set partition problem on this site of Wikipedia: https://en.m.wikipedia.org/wiki/Partition_problem
Among other things, they present a DP approach to solving the equal subset sum problem for 2 subsets by finding a subset that sums to half the total sum of the set. Below the algorithm they state t... |
As you can see from the title this is the impression that i have on this problem, but probably it isn't impossible.
The required DFA is :
"The set of the strings with equal number of 0 and 1 such that for each prefix the difference between the number of 0's and the number of 1's is minor(<) than 2".
Maybe I've misread ... |
Let's say you have a graph like this:
The largest subset of nodes so that every pair of vertices have an edge between them is $\{3, 5, 7, 12\}$. The second largest subsets are
$\{4, 7, 21\}$,
$\{3, 5, 7\}$,
$\{3, 5, 12\}$,
etc.
Is there an algorithm to find the largest subset efficiently?
Also, keep in mind that I ... |
I've been reading this paper: https://ac.els-cdn.com/S0304397511002623/1-s2.0-S0304397511002623-main.pdf?_tid=bc074517-2b81-4d37-bc92-a5c20dba6b23&acdnat=1527946614_083eb7104693637d83e7d26751a7d23e
where it talks about the interval scheduling problem but with n processors for k jobs.
I was wondering if there's a proof... |
First a simpler question: let $q_{1}(k),\dots,q_{n}(k)$ be $n$ polynomials of degree smaller or equal to $n$.
Let $f(n): \mathbb{N} \rightarrow \mathbb{N}$ defined by $f(n) = \sum_{i=1}^{n}q_{i}(n)$.
Assume also $0\leq f_{i}(n)\leq n$.
What is the time complexity as a function of the input size for calculating $f(n)$ b... |
Suppose we have two processes P0 and P1 using Peterson's Algorithm to access a critical section.
Process P0 starts executing and sets its interested to TRUE and turn is set to 0. A context switch happens right after and process P1 starts executing. P1 sets interested[1]=TRUE and turn=1. But since process P0 is also int... |
The following is a screenshot of a lecture slide from my programming language concepts course:
According to Wikipedia and other sources, a regular grammar is one that is either left linear or right linear, meaning it has at most:
one nonterminal symbol on the left end of its right hand side
e.g., A -> Ba
one nonter... |
I have read many resources, but I cannot understand what the polynomial-time reduction is. In everywhere, this is explained with standard-pattern sentences.
Please can anyone explain it in detailed version ?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.