instruction stringlengths 35 11.4k |
|---|
Let $\varphi$ be a boolean formula in 3-CNF form (conjunctive normal form with three literals at most per clause). I want to convert it to an equivalent boolean formula that uses only NOR gates with fan-in 2, without introducing any new dummy boolean variables. I'm wondering how much this will increase the size of the ... |
I wonder what will be the complexity of this algorithm of mine and why, used to check whether a graph (given in the form of neighbors list) is bipartite or not using DFS.
The algorithm works as following:
We will use edges classification, and look for back edges.
If we found one, it means there is a circle in the graph... |
We are trying to solve variant of the n-peg Tower of Hanoi problem.
There can be limitations on possible moves among the pegs.
In the graph vertices are pegs, and an edge
from vertex to another tells us we can move a disk from
the first peg to the other.
We need to find out what are the necessary and sufficient conditi... |
The problem of solving quadratic equations is as follows:
Suppose you are given a set of quadratic equations and are asked to
find $0$-$1$ values for the variables such that all equations are
satisfied. For example, consider the system $$x_1x_2-x_3 = 0$$
$$x_1x_3-x_1x_4+x_3x_4 = 1$$ $$x_1x_4-x_2x_3+x_1x_3 = 0$$ ... |
I'm trying to solve pretty complex problem with number theory and set of numbers.
To make the problem more clear we are going to define $GCD(a, b)$ as the greates number that divides both $a$ and $b$ and $LCM(a, b)$ as least common multiple of $a$ and $b$. For my problem I want to calculate both $GCD(x_1,\dots, x_n)$ ... |
Hopefully this is the right board for my question, We are facing an issue creating a unique ID from the following inputs :
datetime (can be present more than once in the same set, cannot not be present in 2 different sets)
offset ( an integer representing each line position in the set, the offset will be reset when s... |
I was asked to prove that language described by $$ L =\{ a^{2n}: n\ge1\}$$ is regular using pumping lemma. Pumping Lemma states that for regular language we can break down language described by language into $xyz$ where pumping length $p \ge 1$ such that
$|y|>0$
$|x.y| \le p$
$x.y^{i}.z$ is in L for $i \ge 0$
taking... |
http://codeforces.com/problemset/problem/535/B
The problem is:
You are given a lucky number n. Lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
If we sort all lucky numbers in increasing order,... |
Given a trie with word occurrences (frequency), how can we sort the words( both ascending and descending) on the basis of their frequency?
|
I've been thinking about the A* algorithm recently. For context, A* is a graph-navigating algorithm most often used to solve problems that go "What is the shortest path from point A to point B?". It's based on a distance-estimating heuristic you provide to it. The heuristic you provide must be able to tell the program,... |
Let's say I have three classes, Animal, Bird and Pigeon. If Bird extends Animal and Pigeon extends Bird, is Animal the parent class for both or is Bird?
So, for instance, if the constructor for Animal said "hi I am animal" and the constructor for Bird said "hi am I bird", which will it say in class Pigeon if I call th... |
Suppose we have following 2-QCNF problem:
$$\forall x_1...\forall x_m\exists y_1...\exists y_k:\varphi(x_1,...,y_k)$$
where $\varphi$ is 2-CNF.
When the formula is false?
Rules that I found:
$\exists y_i:(y_i\rightarrow \overline{y_i})\land(\overline{y_i}\rightarrow y_i).$ Existentially quantified variable and it's ne... |
I have to implement algorithm, where definitions, input and output of program go as follows:
$Σ$ - finite, non-empty alphabet
A
translation
in
$Z^2$
by vector
$u
= (
u_x
, u_y
)
∈
Z^2$
will be denoted by
$τ_u$
,
$τ_
u
:
Z^
2
∋
(
x, y
)
→
(
x
+
u_x
, y
+
u
_y
)
∈
Z
^2
.$
Definition 1 (Directed Figure): ... |
I am working on a HMM tagger that should be initialized with some small data and then supposedly improved with Baum-Welch algorithm on the data.
However, the number of states is huge, almost $459^2$, so the training would take ages.
For evaluation I already implemented Viterbi algorithm in which I prune and consider on... |
I'm currently trying to figure out whether this language is context-free using the pumping lemma.
$\qquad L = \{ v_1 v_2 v_1 v_2 \mid v_1 \in \{a, b\}^*, v_2 \in \{a, c\}^* \}$
I'm having trouble because I don't know how to use the bound $m > 0$.
|
What is the difference between constant folding and constant propogation? They both seem to do the same thing, instead of saving constants into stack or evaluating a full arithmetic expression, they simply replace it with the result which can be obtained at compile time. What is the difference between two?
|
I was reading about the reduction from 3SAT (input: formula) to Independent set (input (graph, k)) in order to prove that the latter is in NP-Complete. The reduction i've seen follow the next steps:
For each clause at the input, create a node for every variable it contains in case it doesn't exist yet. Then, create a ... |
I would like to show that a problem $A$ is $NP\text{-complete}$. So, I am trying to reduce 3-SAT problem to $A$. Reduction is kind of function, let say $f$. What is necessary complexity of $f$? Probably, it has be in $NP$. But, does it mean that $f$ must be a non-deterministic Turing machine working in polynomial time?... |
Apologies if this is the wrong place to ask.
For my experiment, I have a single-page application and a multi-page application. I am testing them with an exponential distributed delay throttling. The idea is that individual chunks are delayed by a random number sampled from an exponential distribution. So, when a HTTP/G... |
I have a set $\mathcal{A}$ of $\mathcal{m}$ vectors in $\mathbb{R}^a$. I also have a different set $\mathcal{B}$ of $\mathcal{n}$ vectors in $\mathbb{R}^a$. These two sets are disjoint: $\mathcal{A}\cap\mathcal{B} = \varnothing$.
My goal is to find a set $\mathcal{C}$ such that $\mathcal{C} \subset \mathcal{A}$ and $... |
By unique words we understand the such word $w$ that every character in the word occur at most once, for example:
$\Sigma = \{a,b,c\}$
$w = abc$, $v = abca$
$w$ is unique, $v$ is not.
Now, we have a problem:
We have given an alphabet $\Sigma$. We have a given length of word $|w| = n$. How to recognize using $NFA$ wheth... |
I solved this problem using Dynamic Programming in $\mathcal{O}(n)$ time. I found that is equivalent to the Fibonacci Numbers.
$F(0) = F(1) = 1$
$F(n) = F(n-1)+F(n-2)$
Where the $F(n-1)$ term is from fixing the left most domino vertically, and the $F(n-2)$ from fixing it horizontally (which implies that the domino unde... |
Let L1 be the recursive language. Let L2 and L3 be languages that are recursively enumerable but not recursive. Which of the following statements is not necessarily true?
a.) L2−L1 is recursively enumerable.
b.)L1−L3is recursively enumerable.
c.)L2∩L3is recursively enumerable.
d.)L2∪L3is recursively enumerable.
My appr... |
In formal language theory, a context-free grammar G is said to be in Chomsky normal form if
$$ S → A B$$
$$ A → a $$
$$S → ε $$
My question is that if $B$ in the the form of
$$ B → abcd $$
where $abcd$ are terminal symbol, is this still in Chomsky Normal Form? ?
|
I am still in the early phase of getting comfortable with solving recursive problems. I was given
int p(int n) // number of permutations of n objects
int c(int n, int k) // number of unique combinations of k elements out of n elemnts
For instance, {"abc"} as the given string, permutation will be
{"abc"}, {"acb"}, {"b... |
From Wikipedia :
An independent set of $\sqrt{n}$ vertices in an $n$-vertex triangle-free graph is easy to find: either there is a vertex with more than $\sqrt{n}$ neighbors (in which case those neighbors are an independent set) or all vertices have less than $\sqrt{n}$ neighbors (in which case any maximal independent... |
I am learning All pair Shortest Path from CLRS book,but got stuck in the begining itself.I am writing my query.
According to one of the Lemma of shortest path -:
All Subpaths of shortest path are shortest.
Using this lemma, we can write the Structure of shortest path given as-:
Consider a shortest path $p$ from vert... |
I'm aware that a qubit can exist in an infinite number of states and that when measured it collapses into one state, with the probability of each state being directly affected by it's latitude.
My question is: Why is this in any way useful? Surely you can't use a unit of information meaningfully when you don't know wha... |
During my research, I had encountered the following issue. Consider the equation
$$\sum_{k=1}^K\alpha_k P_k = P$$
where $\sum_{k=1}^K\alpha_k=1$, $\alpha_k > 0$, $P_k > 0, P>0$.
So you are given $\{\alpha_k\}$, $K$ and $P$. The task is to generate randomly $\{P_k\}$ such that the above equation is satisfied. I am looki... |
I define a list to be a path where every vertex along the path has precisely two edges, except possibly the starting and ending vertex. In the language of electric circuits, I'm interested in finding all components that are in series for a given circuit. I'm specifically interested in finding all maximal lists. As not... |
I have a slightly modified version of a classical 01 knapsack problem. Specifically, the problem has an additional constraint which requires that if more than one feasible selection with equal value exists then the selection with minimum total weight be selected. For example, consider a knapsack with size 3 and the fol... |
I recently learned about segment trees as data structures, and what I learned was that we are always building segment tree with size $N$ such that $N$ is power of two. If $N$ is not power of two we can add more elements to the end of the tree.
However, I was wondering is the segment tree going to work normally if we do... |
A language I'm investigating is not regular since the minimal DFA for the language grows depending on input string size. However, while the number of non-final states increases, the final states are the same small strictly finite core which include the initial state.
Another question looks superficially similar, hintin... |
Show that the following languages are not regular:
$(1)\ L=\left\{a^nb^mc^k\mid n>k \land n,m,k>0\right\}$
$(2)\ L=\left\{a^nb^mc^k\mid m>k \land n,m,k>0\right\}$
I've difficulties showing that these two languages are not regular by using the Pumping Lemma. Any suggestions?
|
A language $L \subseteq \Sigma^*$ is finite-regular if there exists $C$ such that for all $n$, $L \cap \Sigma^n$ is accepted by some DFA with at most $C$ final states.
Given a finite-regular language $A_L$, am I guaranteed that there exists a polynomial-time algorithm $A_L$ that recognizes $L$? In other words, I want ... |
Based on this article, i am trying to imagine how i would construct an FSA based index for the following string sequence:
ABCDEF
ABDDDF
ABDDEFGHI
These are the representations that i found:
There are problems with each:
The first introduces a new key in the automata that really isn't in the set (ABCDEFGHI)
The secon... |
I know that given problem is in $\mathsf{FP}$: if given formula is satisfiable, then it is only needed to find out how many connected components equality (undirected) graph has. In fact problem is to count the amount of connected components.
However, is it possible to solve it using only log space? Is then the given pr... |
I have made an evaluator of Lambda expressions. I tried to do Y combinator, but for some reason I can't get the original one working:
$$λf.(λx.f \space (x \space x)) \space (λx.f \space (x \space x))\tag1$$
This is probably for a reason, I don't know how to interpret $f (x \space x)$ part, or my evaluator does it right... |
$$UCYLE = \mathcal \{ <G> ~:~ G \text{ is an undirected graph that contains a simple cycle}\}.$$
There are two possible approaches to this exercise:
Solving cycle in undirected graph in log space?
https://stackoverflow.com/questions/29640543/solving-cycle-in-undirected-graph-in-log-space
These two solutions are diffe... |
Given a nondeterministic game how could one know the branching factor of it? Is it the number of all possible outcomes?
I have an example game in which you have some cards. The goal is to get rid of all of them. At the start of the game you get 7 random cards. There is a draw pile from which you take cards if you can't... |
Let's consider the problem:
Prove that decision whether a graph is bipartite is in $LOGSPACE$.
I am convinced that I should use Reingold's theorem. I know that I test whether graph contains an odd-length cycle.
For a given graph $G = (V,E)$ I can define the graph $$G' = (V', E') \\ V' = \{ v^1, v^2 | v \in V \} \\ ... |
I was asking to prove that
For any directed graph, when we perform BFS, for each cross edge $(u,v)$,
there is some time when both vertices $u$ and $v$ appear in the queue.
(In other words, we have a queue like this: $Q = \langle v_1,v_2,..u,..,v,..v_k \rangle$.)
However, when I draw some graph; I've encountered ... |
I'm working with the Welder proof assistant. Basically, this system uses basic inference rules to modify the goal one wants to proof. At a latter step, the modified goals are passed to a SMT solver to see if it can prove them. I have already written automatic induction tactics that generate by themselves the induction ... |
Let's recall the definition of an applicative functor. Throughout this question, I write $x: T$ to denote that the value $x$ has type $T$.
Definition: An applicative functor consists of a type constructor $F: * \to *$ together with two operations:
a function $\mathsf{pure}: A \to F(A)$ that transforms a base value $x... |
Are there any systems that operate primarily by punch cards (loading/saving data) in production usage today? (Or at least up to the year 2000?)
|
It seems to me that genetic algorithms would be an ideal way to train neural networks so that they come to have the right weights, since they are especially good at escaping local minima, and converging on a global optimum. However, from my rudimentary knowledge of neural nets so far, I haven't come across this method ... |
CASC is the premier Automated Theorem Prover competition performed annually at the Conference on Automated Deduction (CADE). The 2017 event has finished on the 9th of August this year.
During this conference provers are faced with a set of problems and a time limit of 5 minutes (300 seconds) per problem.
When the compe... |
If I had an arbitrary amount of space at my disposal, couldn't I vectorize/parallelize any program in such a way that it would only need one step? For example, I could let my CPU have an inbuilt look-up-table for the function (x+y)/z with 3 input values instead of doing the calculation in 2 steps.
Does there exist any ... |
Suppose that $T$ is a set of vertices in an unknown network.
We have oracle $F(X,Y)$ that returns maximum flow value between $X, Y \subseteq T$ in the unknown network.
Can we reconstruct the unknown network by calling this oracle polynomially-many times?
More precisely, can we construct a network whose flow function is... |
From my limited understanding fully persistent data structures allow changes to be made to previous nodes, with new nodes creating a branch rooted at the changed node, resulting in a tree of nodes and also disallowing the remerging of these branches.
o o o
/
o o o o o o o o o
\
o o o
Confluently pers... |
Let's say we have a set of sets:
$$\mathfrak S = \lbrace S_1, S_2, ... , S_n\rbrace$$
And the union of the all the sets in this set:
$$\mathfrak U = \bigcup\limits_{i=1}^{n} S_{i}$$
And so there is at least one minimum set of sets that is identical to this union:
$$(\mathfrak M \subseteq \mathfrak S) = \mathfrak U$$
W... |
I am trying to prove why the below language is not context free. Note: this should be carried out by applying the pumping lemma for context free languages.
To prove something with the pumping lemma, we firstly need to choose an arbitrary m > 0. After that we need to formulate the string (alpha below) we are going to r... |
We define xor operation on languages $L,M\subseteq \{0,1\}^*$:
$$L\oplus M = \{u\oplus v :|u|=|v|, u\in L, v\in M\}$$ $\oplus$ is
defined as xor on postions, for example: $001\oplus 100=101$ Show
that there exist languages $L,M\in PTIME$ such that $L\oplus M\in
NP complete$
It is hard to me. I have been ... |
I'm trying to solve the excersice from Knuth's "Concrete
Mathematics":
A Double Tower of Hanoi contains 2n disks of n different sizes, two of
each size. As usual, we're required to move only one disk at a time,
without putting a larger one over a smaller one.
How many moves does it take to transfer a double tower fro... |
Are there any proofs that BQP is not in P? In laymen's terms, I am asking if there is any formal proof separating the complexity class that quantum computers are presently assumed to solve efficiently from the complexity class that non-quantum computers are presently known to solve efficiently.
Obviously I'm not talki... |
I am making a solver to choose the best assignment to a set of people for an event, given their availability (chosen in a set $T$ of time slots), jobs preferences (among $J$ possible jobs) and some of other predefined constraints. We refer to a particular pair of (job, time slot) as a "shift".
I'm not optimizing the en... |
In books, I have read that FCFS suffers from convoy effect. I think that even SJF and priority(both preemptive and non preemptive) can suffer from convoy effect.
In SJF, if a process with large burst time arrives first then no other process can preempt it causing convoy effect.
In preemptive and non preemptive priority... |
$\mathsf{DFS(G, u) \text{}}$, $G = (V,E)$
Input : A Directed graph $G$ and a source vertex $u$.
Find : Is $v$ reachable from vertex $u$ for all $v \in V$ ?
Model of computation : Word RAM , one can represent a vector $A[1,\cdots ,n]$ of elements from a finite alphabet $\Sigma$ using $n \lg |\Sigma| + O(\lg^2 n)$ bits... |
I tried to solve this exercise:
Discuss the normal forms (CNF or GNF) of a grammar with productions:
$S\rightarrow BC | CB$
$B\rightarrow cB | c$
$C\rightarrow cC | \epsilon$
Same request with the following grammar:
$S\rightarrow BC | CB$
$B\rightarrow cB | c$
$C\rightarrow cC | c$
I applied the rules to convert a gra... |
PIVT cache is indexed physically so address translation using TLB is needed to get into cache and we use virtual address as the tag for comparison .
I read that homonym is a problem which is caused when same VA maps to 2 different physical addresses and PIVT suffers from homonym.
Source :- https://stackoverflow.com/qu... |
So merge sort is a divide and conquer algorithm. While I was looking at the above diagram, I was thinking if it was possible to basically bypass all the divide steps.
If you iterated over the original array while jumping by two, you could get the elements at at index i and i+1 and put them into their own sorted arrays... |
I'm reading side by side my class notes and Papadimitrious' Computational Complexity book. At this point they are talking about space complexity. They give rules for computing space employed in an algorithm that runs on a multi-tape Turing machine:
We count the cells used.
If we don't write in the input, this cells do... |
Input: amount of variables (with minimum of $10$ since otherwise problem is unsolvable).
Output: unsatisfiable formula.
Restrictions:
Every clause contains exactly 3 variables.
Every clause differs by at least one variable. For example, a pair of clauses $(x\lor y\lor z)\land(x\lor \overline y\lor\overline z)$ is for... |
I am trying to implement a fast SVD algorithm for obtaining the first $k$ singular values/vectors of an $M\times N$ matrix ($k < \min(M,N)$) using the following 2-step process:
1) bidiagonalize the matrix using Lanczos bidiagonalization (e.g. R. M. Larsen, 1998)
2) diagonalize the bidiagonal matrix via QR decomposition... |
An elegant program for a bitstring is the shortest program on a universal Turing machine that outputs this bitstring. According to Kolmogorov complexity, the length of the elegant program is independent of the Turing machine implementation.
Solomonoff induction uses the elegant program for a bitstring to predict the n... |
Is the language $A$ decidable ? Please help me get the proof right !!
$A = \{ \langle M \rangle | M \text{ is } TM \text{ such that } L(M) \neq \Sigma^* \}$
My proof is by contradiction. Assume $A$ is decidable and let $R$ be decider for it. I will construct decider $S$ for $A_{tm}$, using $R$ as a subroutine.
S = ... |
Using three valued logic one can define a multitude of ternary operations. When dealing with 5:3:1[1] operations, its very easy to see how OR and AND work, but I'm confused as to how ternary BUT is supposed to be useful. As mentioned here in TriINTERCAL's[4] docs the truth table for ternary BUT is as follows:
BUT(True... |
I have implemented three algorithms codes, in Swift:
1- Polynomial coefficient:
// create polynomial
func arrangePoly(ofTerms term: Int, toLength len: Int) -> [Int] {
var a = Array(repeating: 0, count: len+1)
for i in stride(from: 0, to: a.count, by: term) {
a[i] = 1
}
return a
}
// polynomial... |
For words of the same length $u = u_1..u_n, v = v_1..v_n$ over an alphabet $A$ let $$u \circ v = u_1v_1...u_nv_n$$
Prove that if $L$ over $A \times A$ in in LOGSPACE then $$L' = \{uv : u \circ v \in L\}$$
is also in LOGSPACE
My solution:
We try to log-reduce $L'$ to $L$. So, I mean when a machine $M_L$ tries to read an... |
Prove that following problem is complete in NP in sense of Karp.
Given: context free grammar $G$
Check if $G$ generates word containing
all symbols from alphabet
Remark
Above problem should be encoded as langauge over finite alphabet, although alphabet of $G$ can be arbitrarily big. You can assume that symbols of thi... |
From my understanding a problem is considered to be in NP time if it can be solved in polynomial time with a non-deterministic Turing machine and verified in polynomial time with a certificate.
My question is whether or not creating an algorithm to determine values accepted by a certificate for an NP problem can itself... |
Let $a\uparrow^{n} b $ denote the indexed version of Knuth's up-arrow notation ($a \uparrow\uparrow \dots \uparrow b$ with $n$ arrows), with $a, b, n$ positive integers.
Is there a generalized algorithm to compute $a\uparrow^{n} b$ modulo a prime efficiently? How does the complexity of such an algorithm depend on $n$? ... |
Formally show that $0.1n + 10\sqrt{n}$ is not $O(\sqrt{n})$ using the definition of $O$ only.
I cannot find much on how to solve a problem like this, nor do i know how. Am I supposed to show some contradiction by trying to prove it is $O(\sqrt{n})$? Any help on how to answer this would be appreciated.
This is about me... |
Apologies for this edit (8.13). I encourage those interested in the math side of this variant to view the MathOverflow post mentioned below, and contact me at that forum. This version is an attempt to find a CS reference.
I am researching mathematical properties of a variant of the sieve of Eratosthenes. Has anyone ... |
I have some issue but I can't identify a way to solve it. I wanted to ask you what kind of problem it is?
We have a resource - contiguous computer memory. Also we have users which require some contiguous piece of memory during a period of deterministic time.
In example,
User1 uses 2 bytes from 3rd to 5th iterations (i... |
Resolution allows to generate new clauses for an existing set of clauses.
In many cases, the rule is simple:
{ a, b } { -a, b }
----------------------
{ b }
But what if the clauses contain multiple literals suitable for resolution?
{ a, b } { -a, -b }
-----------------------
{ ? }
If we choose... |
A minimal unsatisfiable partial assignment for 3-CNF is a partial assignment that:
There exists a clause where all variables are unsatisfied.
Unfixing any variable makes every clause contain at least one free variable.
Particularly for 2-SAT and 3-SAT is their number bounded by polynomial?
If yes, then how can the nu... |
Dynamic Programming C/C++ implementation of LIS(Longest Increasing Subsequence) problem
/* lis() returns the length of the longest increasing
subsequence in arr[] of size n */
int lis( int arr[], int n )
{
int *lis, i, j, max = 0;
lis = (int*) malloc ( sizeof( int ) * n );
/* Initialize LIS values for all indexes */
... |
I read an example that said explain what "$f(n)$ is $n^{O(1)}$" means.
I can't interpret the $n^{O(1)}$ syntax. I know what Big $O$ notation is, its just that this example looks odd to me.
|
I just learned about Gibbs Sampling which is an MCMC method. Given a distribution $\pi$, we want to sample an item according to $\pi$.
Maybe my alternative suggestion would sound somewhat naive (even stupid) but why can't we just draw a number in random from $[0,M]$ for some sufficiently large enough $M$. Then, we divi... |
Classical computer always requires no matter what $\Theta(n)$ time to compute the sum of $n$ natural numbers, but can quantum computer do that in $\Theta(\log n)$ time?
Given that $a$ is an infinite sequence of natural numbers defined either iteratively or recursively by some math formula and $a_i$ is an arbitrary natu... |
If the complexity of an arbitrary algorithm to solve any NP problem after analysis is $\Theta(2^\sqrt{n})$ then is this algorithm considered as "good" and practical algorithm?
I know that in algorithm analysis and computational complexity theory every algorithm with any polynomial complexity is considered as "good" and... |
I have $n$ points that form a grid with empty space and I need to find an algorithm that would calculate the total distance of those points with time complexity lower than $O(n^2)$.
An example of a grid with $n=5$ would be the following set of points:
$(1,0)$, $(0,1)$, $(2,0)$, $(2,1)$, $(2,2)$. As you can see their $x... |
Prove that problem $A$ is complete in $P$ due to reductions
computed in logarythmic space
How to understand this statement ? What should be shown ? For me:
1. $A$ is in $P$.
2. Each problem in $P$ can be reduced in logspace to $A$
Can I use transitivity of logspace in this exercise ?
|
Given a large graph $G=(V,E)$, a set of nodes $S\subseteq V$, the problem is finding the $k$-nearest nodes in $V$ to the nodes in $S$.
Given a pair of nodes $(u,v)$, the distance $d(u,v)$ between $u$ and $v$ is defined as the length of the shortest path between them. Hence, the lower the distance is, the closer two nod... |
Consider two algorithms; we analysis their run time only by counting the number of comparisons
TwoMax1(A):
S = negative infinite
L = negative infinite
loop through the array A
if A[i] > L:
S = L
L = A[i]
else
if A[i] > S
S = A[i]
... |
Let $X,Y$ be two random variables over a discrete probability space, such that $X \in [0,1]$ and $Y \in [0,1]$. I want to prove that $$ |\text{Cov}[X,Y]| \leq \sqrt{0.5 \; I[X,Y]}$$ where $I[]$ is the mutual information of the variables. Is there an "elegant" way to prove that? Some smart argument rather than techni... |
Some programm should allow users to identify the word language probability. All i have is some statistics - the frequency of using bigrams and trigrams in most of texts of some languages.
Totally i have
Top English bigrams Top Spanish bigrams ...
th de ...
he ... |
In his famous paper, Turing briefly describes his machine and then states (p. 232) (emphasis mine):
It is my contention that these operations include all those which are
used in the computation of a number. The defence of this contention
will be easier when the theory of the machines is familiar to the
reader.... |
My professor asked this question in his lecture class and I can't figure out the answer.
My guess is BCD because you can't use up all the numbers (10 to 15), so you eat up space?
|
I am reading CPDAG, can anyone please explain why G1 and G3 are not equivalence classes as in the picture below?
Thank you very much!
according to https://www.cs.cmu.edu/afs/cs/project/jair/pub/volume18/acid03a-html/node2.html .
"Theorem 1 [59] Two DAGs are equivalent if and only if they have the
same skeleton and t... |
I recently came across an issue where my compiler was not able to eliminate some "obviously" dead code - it was a function that returned nothing, with no side effects, and a cursory analysis of the code revealed that it would obviously terminate.
Investigating this further, I found it was extremely easy to write very s... |
Theorem. Let none of the assignments of length $\log n$ make a set of unsatisfiable 2-clauses. Then formula is satisfiable.
$n$ is input length here.
Let we name an assignment that make the formula to contain unsatisfiable 2-SAT contradictive.
This allows us to find all minimal contradictive assignments in $O(n^{\log n... |
I am studying for my exam in Distributed Systems course. And i have one question that i do not really understand. This is the question:
Is sequential consistency compositional? if yes explain why, if no give an example.
Now this is the only two slides that we have that explains why it is not composable.
And i am havin... |
I conisder a problem:
It is given a graph $G$, vertices $s,t$, $k$- length of the graph. Prove that decision whether there is a path between $s$ and $t$ of length $k$ is NP-complete.
Please note that in our problem we have a path, not a **simple path* **
*It is trivial when we have a simple path (define as sequence o... |
I wanted to know something about selection and Time complexity,
for example if I had the f.f.g java code:
public List<String> sort(int n, List<String> ob){
if(n == 1){
return binarySort(ob)
else{
return selectionSort(ob)
}
I know this is a weird example but I feel it should help me understand what to do when... |
Assume I have a word document, the contents in it are stored on the disk as bits. Nothing so complex here. When the word processor reads those bits, it just knows how to display on screen.
But what about binary trees. They are just not data, they have route node, child nodes. How are they actually represented on disk?
... |
A procedure by induction to get maximum spanning bipartite graph (same vertex set as $G$ and the maximum possible number of edges) from given graph $G$:
Given a planar graph $G$, we need two disjoint sets $V_1$ and $V_2$. We define $V_2=V \setminus V_1$ where $V = V(G)$. In the following, $H$ is the bipartite subgraph ... |
Many inapproximability factors are $2^{n^\epsilon}$. I don't know why this is 2 instead of 3, 4, ..., etc.
To be precise, given a problem,
theorem 1 says: It's NP-hard to approximate the problem to $2^{n^\epsilon}$ for any $0 \leq \epsilon < 1$;
theorem 2 says: It's NP-hard to approximate the problem to $3^{n^\delta}$... |
I'm reading the book Introduction to Algorithms and in Chapter 3 it is said that if $f(n)$ and $g(n)$ are asymptotically positive then
$$
f(n) = O(g(n)) \text{ and } g(n) = O(h(n)) \text{ implies } f(n) = O(h(n))
$$
However, I don't see why this wouldn't also be valid if you just required $f(n)$ and $g(n)$ to be asympt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.