instruction stringlengths 35 29.1k |
|---|
given some $n$ variables I would be interested to know what is the count of all 3SAT formulas under $n$ that are unsatisfiable.
An example of all 3SAT forumlas under $n=3$ is the following:
$$
( x \lor y \lor z) = Satisfiable
\\ ...
\\
( x \lor y \lor z)\land ( \neg x \lor \neg y \lor z)= Satisfiable
\\ ...
\\
( x \lo... |
I got a question:
Design a pushdown automata that can recognize strings in L= {$ a^n b^{2n} c^{3n} | n ≥ 0 $} .
I tried to think and design it, but I couldn't find it. The best that I can think of is L= {$ a^n b^{m} c^{m+n} | m,n ≥ 0 $} . I only can make sure that c appears as much as a+b appear.
So, I'm wondering, is ... |
I am currently working on data compression and thought it would be a good time to read up on the basics of information theory to better understand data compression and its algorithms.
As I understand, given a set of data, we can compute the minimum no. of bits on average required to encode the data my multiplying the r... |
Given an undirected weighted graph $G$ and two vertices $s, t$. We want to find a path $P$ from $s$ to $t$ that minimizes the following objective function $L$
$$L(P) = max(len(P), max\{c(e) \mid e \in P\})$$
For example, consider the following graph
Here we have two ways to go from the green node to the red node. Eith... |
I have encountered a following problem:
Given the list of $k$ values from range $[v_{min}; v_{max}]$, find $m$ non-overlaping ranges of length $l$, such that maximises the number of values from the original range that would fit into those new ranges.
For example:
Given a list [2, 3, 4, 5, 10, 11, 12, 21, 22, 30, 31, 32... |
Suppose I have a graph with node weights, where a weight is either -1 or a positive integer. For example:
If a node has weight -1, it is "happy", and cannot be kicked out of the graph.
If a node has positive weight, it is "unhappy", and can be kicked out of the graph.
How do I efficiently calculate which unhappy nodes... |
Most versions of simulated annealing I've seen are implemented similar to what is outlined in the wikipedia pseudocode below:
Let s = s0
For k = 0 through kmax (exclusive):
T ← temperature( 1 - (k+1)/kmax )
Pick a random neighbour, snew ← neighbour(s)
If P(E(s), E(snew), T) ≥ random(0, 1):
s ← snew
Output: th... |
VC dimension covers the binary classification case, i.e. when we want to get a predictor $X \to \{0, 1\}$.
Using VC dimension, we can get the upper bound on the sample complexity for PAC-learning.
In our problem, we have 3 classes, i.e. we want to train a predictor $X \to \{0, 1, 2\}$.
We know a "VC dimension" for our ... |
Let there is an algorithm whose running time is $O(n^2)$. Suppose we apply a preprocessing step on the algorithm in $O(n)$ so that it reduces the input size to $O(\sqrt{n})$ but doesn't effect the true answer of the algorithm. It is just for optimization. Now is it true to say that the running time of the algorithm is ... |
I want to find out how to check, if the following relationships are true or false.
f(n) = nlog(n!); g(n) = nlog(2n^3n); Check, if f(n) = O(g(n)) and/or f(n) = Ω(g(n)) true/false;
f(n) = 3n^2; g(n) = 9^(base3-logn); Check, if f(n) = O(g(n)) and/or f(n) = Ω(g(n)) true/false;
I am very new to this topic, so i would be ver... |
Given an undirected graph $G=(V,E)$ where $V$ is a set of vertices, and $E$ is a set of edges and
given a set $D$ where $D \subseteq V $ and $ \forall v \in V \setminus D \: \mid \: \exists w \in D : \{v,w\} \in E$
INPUT an undirected graph $G=(V,E)$ and a number $k \in \mathbb{N}$
PROBLEM $X$ : Does a set $D \subset... |
Okay so imma noob as my question itself will suggest . And I know that of If I want to access a public class member we have to use the dot operator with the object .
So we know that int , float etc are also classes ..so why don't we use dot operators with the variables of that data type...?
|
Let $\Sigma$ be a finite alphabet. All strings below are over $\Sigma$.
Definitions:
If a string $s = vw$, then $v$ is a $\textit{prefix}$ of $s$ and $w$ is a $\textit{suffix}$ of $s$.
For a language $L \subseteq \Sigma^*$, define $L_n \subseteq L$ to be the set of strings in $L$ of length $n$: $L_n = \{s \mid s \in L... |
Let $S = \{\langle M\rangle | M \text{ is a TM and } L(M) = \{ \langle M\rangle\}\}$. Prove that neither $S$ nor $\overline{S}$ is Turing-recognizable.
I think the statement can be proved via a contradiction. Suppose $S$ is Turing recognizable and let $M$ be a TM recognizing it. Then M accepts all strings $\langle T\... |
This is from Ex. 0.2.(b) from "Computational Complexity" by Arora and Barak (2009):
One needs to find a non-recursively defined function $g$ s.t. (1) $f = O(g)$ and (2) $g = O(f)$, where $f(n)=f(n-1)+n$ for $n > 10$ (and $f(1) = ... = f(10) = 1$). Solution booklet says that $g(n) = n^2$, but I cannot see how to prove ... |
From what I've read, there are $C$-complete problems for all the complexity classes $C$ that I have looked at: $P$, $NP$, $EXPTIME$, $PSPACE$. But I also know that there is an infinite hierarchy of complexity classes. I'm wondering if there are uniform/general reasons that complexity classess have problems that are com... |
A computable function, formulated in the sense of mu recursion, can compute a for or do loop over some (possibly infinite) integer range.
I was wondering if a suitable generalization exists that allows the computation of a real-domain function $f$ where $f(x)$ can be calculated given the values of $f(y)$ for all real $... |
Given a geometric graph (interval, circular arc, disk, etc.), is there a difference between the realization of that graph and the embedding of that graph?
|
I have a minimax problem of the form $$\max_{\substack{u_1,\dots,u_n \ge 0 \\ u_1+\dots+u_n = 1}} \min_{\substack{v_1,\dots,v_m \ge 0 \\ v_1+\dots+v_m = 1 \\ v_{j_1} \le v_{j_2} \hspace{1mm} \forall (j_1,j_2) \in J}} \sum_{i=1}^n \sum_{j=1}^m c_{i,j} u_i v_j,$$ where $J$ is some (given) subset of $[m]\times[m]$ and eac... |
It is very surprising to me that some combinatorial games such as generalized chess are EXPTIME complete. I have no idea why having a solver for a combinatorial game allows you to solve arbitrary exponential problems. The reason is that while I understand that such games can be solved in exponential time, they seem to ... |
I'm using Bayesian optimization for a pretty cost expensive function in the context of neural networks in order to optimize hyperparameters for the neural net.
Is there a general, quantitative way to distinguish between becoming stuck in a local minimum in the optimization or just long running time of the process?
|
Consider a real-valued $L$-smooth and non-convex objective function $f: \mathbb{R}^n \mapsto \mathbb{R}$. There exists a bound on number of iterations in order to find a (local) minima using ordinary gradient descent (see page 15-20 here). The basic idea is to combine the condition of $L$-smooth and gradient descent al... |
Introduction:
Hi, I'm quite new to types so apologies in advance for the basic question and for any abuse of terminology. I believe I have a critical misunderstanding of dependent product types (and probably about types in general to be quite honest). My questions is based on a reading of Andrej's very helpful answer h... |
As far as I know, XMM is used to store floating point. But Highest width floating point according IEEE754 standard is double precision (64-bit). But why XMM register width is 128-bit. Is another 64-bit space is wasted? If not, then what the purpose of another wasted part (another 64-bit)?
|
Assume we have an algorithm consists of several (assume m and m<10) different algorithms each of which has time complexity $O(\log N)$. Is the time complexity of our algorithm is $m*O(\log N)$ or it is $O(\log N)$. which one?
Based on what I understand as the complexity is an approximation, the complexity is $O(\log N)... |
I'm embarking on my first adventure into the world of interactive proofs (IPs). Reading through Thaler's survey, I became interested in IP transformations with respect to error.
Since it's possible to transform an arbitrary IP with completeness error (≤ 1/3 [FGM 89]) into an IP with perfect completeness, I became curio... |
This certain Khan Academy videos introduces the intuition about information entropy: https://www.youtube.com/watch?v=2s3aJfRr9gE&t=102s . It relates information entropy to the expected number of questions needed to be asked to determine the given letter produced by a certain machine according to certain way of asking s... |
Given multiple sets of three items, how can I find the most-commonly occurring item among the sets using only one item from each set. The sets don't have duplicates, but if I'm thinking about this properly, it shouldn't matter.
Example: (1,2,3), (5,3,6), (4,3,7), (8,7,9), (5,1,8)
I want to see which number is the most... |
The question Is busy beaver the fastest growing function known to man? is answered negatively, pointing out that arbitrarily fast growing functions can be constructed.
But is there a "reachable" lower bound for uncomputable functions, or can the growth rate be just e.g. endlessly halved while still remaining uncomputab... |
I'm trying to solve a problem which I can solve in 3SAT or as a mixed 2,3,4 SAT. I know how hard each of those categories are individually and know the derivations of their hardness individually. But I don't see how those can be combined to give me an idea of comparative hardness of 3SAT vs 2,3,4 SAT. By how hard, I me... |
I have a string $a_0a_1..a_{n-1}$
Lets say we split the string at pos $i$, so the string are
$a_0a_1....a_{i}$ and $a_{i+1}a_{i+2}....a_{n-1}$
Now I need to compute:
$max(LCS(a_0a_1....a_{i} , a_{i+1}a_{i+2}....a_{n-1}))$ for all $i$ in $[0,n-1]$
common LCS algorithms takes $O(n^2)$ time. so if we use that n times it ... |
I am working at a Biomedical Center right now and my task is to track both pawns of rats and count the number of times they touch the glass surface.
To elaborate. I have a setup that contains one glass cylinder and 4 cameras that record the rat at 4 perpendicular angles. I need to train a model to track the rat's left ... |
I can't seem to grasp the term of reduction that well.
To explain I will take an example the problem of $$\sqrt{k} - clique $$ such that $$ k \leq \sqrt{V}$$
Solving by reduction with normal k-clique such as
$k-clique \leq \sqrt{k}- clique$
The reduction would be function f, such that f(G,k,) = (G',k')
where the input... |
I've been under the impression that RBM can be used for a variety of applications and a cursory search on google seems to confirm this. But I've heard from multiple people (including a peer reviewer) that they're not considered to be "good," whatever that means. Is there a limitation of RBMs that I'm not aware of? Is i... |
Most programming languages are Turing complete (finite memory blah blah blah), and when we design languages this is a goal.
But is it really necessary? What algorithms do we typically use that require Turing completeness? And do most industry software actually require it?
Like what can't pushdown automata do?
|
I’ve been researching an optimal strategy of playing in mobile game of Ingress and came up with an interesting (for me) computational geometry problem.
Statement of the problem: You’re given N distinct points on plane, and number M < N. Find a simple polygon with M vertices out of the given N points, that maximizes num... |
Studying Os development I encountered the need to interface with the Hard Disk Drive and thus i started learning how it actually works.
One of the problems that i found studying was that different sources said and claimed different things about the Hard Drive's structure.
So, i have some questions:
Is a Sector a Geome... |
Consider I have the following binary image (each pixel is either 0 or 255). How to count the number of lines (they could be straight or a little curvy). For example, in the picture, there are six lines except for the circle. The goal is to compute the number of cracks and its total areas.
|
Given $n\times n$ dense real valued matrices $A_1,\ldots, A_L$ let $P_i=A_1\ldots A_i$
For each $P_i$ I'm interested in obtaining the sum of all rows, and the sum of all columns.
Naive approach:
takes $O(L n^2)$ time to get $L$ rows sums
takes $O(L^2 n^2)$ time to get $L$ column sums
Is there a way to estimate $L$ co... |
According to this answer, given input $2^n$ (and thus input size $n$), this problem is not computable by a deterministic Turing machine in number of steps polynomial in the input size (though it is polynomial time computable under the Arithmetic model). Does this imply that the decision version of the problem is not in... |
I've been tasked with solving this problem, but I'm not sure where to begin:
Let $L$ be a context-free language. $L'$ contains all the words that belong to $L$ which can't be defined as $z=uvwxy$, for which $|vx|>0$ so that $\forall i \ge0$ we get $uv^iwx^iy\in L$.
Is $L'$ a regular language, context free but not regu... |
I have just started to study "Lambda-Calculus and Combinators, an Introduction" by Roger Hindley.
There is a formulation of B ̈ohm’s theorem that I can not understand.
$M$ and $N$ are terms in bn-normal form. Based on the description I assume that $M$ could be equal to λ-term $x$ and $N=y$. $x≠y$. Both $x$ and $y$ do ... |
My question relates to Problem 22.-2 in Introduction to Algorithms 3rd edition.
There biconnected components are defined as maximal sets of edges such that any two edges in the set lie on a common simple cycle. The problems that I am having are the last two tasks of this problem, namely
proving that biconnected compon... |
A strict left fold is straightforward to implement as a loop, rather than with recursion:
foldl(fn, acc, list)
loop until empty(list)
acc ← fn(acc, head(list))
list ← tail(list)
return acc
For a strict right fold, the best I've been able to come up with is by maintaining a stack of partially a... |
Constructivist mathematics states that in order to prove something, we must construct this something, in a notion similar to computation, where things don't spring out of nowhere from some "mystery platonic relationship". The theory behind this I already know. A thing that I just can't understand is, if computation req... |
In the standard definition of the Index problem in one-way 2-party communication complexity, there are two players, Alice and Bob. Alice gets a binary input vector $x$ of length $n$ and Bob gets an index $i$. Alice can send a single message to Bob who must output $x_i$. It is known that this problem has a lower bound o... |
I was reading this classical Coin Problem (7.1): Given a set
of coin values coins = {c1, c2,..., ck} and a target sum of money n, our task is to
form the sum n using as few coins as possible.
I fully understood the discussion until I encountered the last code snippet of the section Constructing A Solution:
int firs... |
I am currently studying triangular mesh generation in 2D and, in that connection, the Delaunay triangulation of a list of vertices $\{ v_1, v_2, ..., v_N \}$. The divide and conquer algorithm of Lee & Schachter (from their paper "Two Algorithms for Constructing a Delaunay Triangulation", 1980) constructs the Delaunay t... |
In a classical definition of the FPT complexity class, for a parametrized problem $L\subseteq \Sigma^* \times \mathbb{N}$ we require an algorithm, solving an instance $(G,k)$ in time $f(k)\cdot n^{O(1)}$, where $f$ is a computable function.
Very simillarly, there is a notion of parametrized reduction, where we require ... |
Our prof talked about why it's good to know that 3-SAT is NP-complete because it's easier to craft reductions from it than from plain SAT.
However, all the examples we've seen (reduction to independent set, Hamiltonian cycle, etc.) seem to work even if we start from a SAT formula and not 3-SAT.
Is there an example of a... |
We have an unstructured cloud of $N$ points in 3D space. What is known about the complexity of building the Euclidean Minimum Spanning Tree of the points ?
The tree is made of $N-1$ edges and can be built as a subset of the Delaunay triangulation in time $O(N^2)$, but I don't think that this is tight.
|
Can every undirected graph be transformed into an equivalent graph (for the purposes of path-finding) with a maximum degree of 3 in logspace?
Given an undirected graph G, is there another graph, H, such that:
all vertices of G are in H
H is allowed extra vertices not in G
if a and b are connected in G, a and b are als... |
Is it correct that, under a certain signature S, two First Order Logic formulae F and G are equisatisfiable if (F is satisfiable under S iff G is satisfiable under S)? But in Skolemization I’m confused because the signature ends up changing when fresh functions are added (when you remove the for-all quantifiers), so ho... |
I have a 3D space where N spheres of identical size, identified by the location of their centers, are continually inserted. When a new sphere is inserted, I have the ability to efficiently query the locations of any other spheres that may intersect with this sphere.
I can also compute the vector two intersecting sphere... |
Let's assume that I am continuously receiving big amount of data. For example, this millisecond I get 100 numbers, next millisecond I get another 500 numbers, after that I might get nothing for a several milliseconds and then again get some numbers in the next millisecond. Also assume that this process lasts for weeks.... |
I'm trying to find an optimal combination of players given certain constraints.
There are ~300 players.
10 players has to be chosen in the combination.
Each player has an assigned value. The goal is to optimize for the sum of their values.
Constraints:
Each player has a price. The sum of their prices has to be less th... |
I was playing nandgame.com and noticed that the arithmetic unit of the ALU was doing both the add and subtract operation in parallel, but only asks for one operation per instruction. This to me seemed like it wasted resources, and I was interested in if this was a normal design-pattern in ALUs/CPUs. My question is, bro... |
Let $L_1 \in NP, L_2 \in NPC$. It is known that if $L_1 \in P$ then $L_2 \in P$.
Can we formally deduce that $L_1 \in NPC$ (show that $\forall L'\in NP$ exists a polynomial reduction $L'\leq_p L_1$)?
|
In reading the paper "a strip-packing algorithm with absolute performance bound 2", the author gives a recursion formula $T(l)=T(l')+T(l'')+O(min\{l'\log{l'},l''\log{l'}',l\})$, where $l'+l''=l$,$l'>0$,$l''>0$, I'm confused about the complexity of the recurison formula, how to obtain $T(n)=O(n\log^2(n)/\log\log n)$?
h... |
Let $S$ be an array of length $n$ containing a random permutation of numbers from $0$ to $n-1$. What is the most efficient (in expectation) algorithm for finding the location of a given number $k$ in $S$? In other words, finding index $i$, such that $S[i]=k$.
I watched a video about a related puzzle and it seems that ... |
I have a problem where I have to find all the pairs of a list of People where the sum of their age is equal to a given number under time complexity less than
O(N²)
Eg:
Input:
{(Jhon, 10),(mary,20),(paul,10),(joseph,15)}
Sum:30
Expected results:
{(John, Mary), (Mary, Paul) }
The worst scenario i can imagine is whe... |
I am trying to understand why the ellipsoid method is not a strongly polynomial time algorithm for linear programming. Using wikipedia's definition, an algorithm runs in strongly-polynomial time if:
The number of operations in the arithmetic model of computation is bounded by a polynomial in the number of integers in ... |
Suppose that you are given an algorithm A that finds the optimal solution to the shortest lattice vector problem (SVP) in time $t(n)$
I am trying to solve the Small even set problem (SES) using it:
The input is a set $S$ of $m$ vectors $v_1,...,v_m$ with each $v_i$ in $\{0,1\}^d$. The goal is to find a non-empty small ... |
Question: Use the Pumping Lemma to show $L_1 = \Sigma^*\setminus\{0^n1^n: n\geq 0\}$ is not regular, for $\Sigma=\{0,1\}$.
My thoughts: I understand that $L_2 = \{0^n1^n: n\geq 0\}$ can be shown to be not regular using the Pumping Lemma by starting with a string in $L_2$ of length at least the pumping length, and try t... |
I am reading Slavik's paper A Tight Analysis of Greedy Set Cover. Specifically, Slavik considers the unweighted version of set cover where the ground set is ${U = \{1,\ldots,m\}}$ for arbitrarily large $m$. There is a collection of subsets ${S = \{S_1,\ldots,S_n\}}$ that is a cover of $U$. The goal is to find the sma... |
I am working through the book Computer Systems: A Programmer's Perspective.
The authors explain that round-to-even rounding can be applied for values that are halfway between two possible results. For example, $10.11100_2$ would be rounded up to $11.00_2$ and $10.10100_2$ would be rounded down to $10.10_2$.
In general,... |
just given solution on this post
i had mention the time complexity to convert string to int is O(n), also verifying this post
now in one of comment fellow SO user, corrected me with example also mention in solution, that for every 10x increase in size time is increased by 100x time.
so i found, post where it mention th... |
Are pure functions always computable functions?
In computer programming, a Pure function is a function that has the following properties:
(1) the function return values are identical for identical arguments (no variation with local static variables, non-local variables, mutable reference arguments or input streams), an... |
Gandalf61 mentions here that there are opcodes that "load the next word into Register A", treat the bits at the next address defined by program counter as data and loads this data. I am interested in examples of computers and CPUs that have such as opcode.
Context: Learning basic computer architecture, and interested i... |
I'm studying substitutions. A substitution is a set of mappings from variables to terms $\{a \rightarrow b; c \rightarrow d;...\}$.
Given these substitutions:
$\sigma_1 := \{x \rightarrow y\}$
$\sigma_2 := \{y \rightarrow x\}$
$\sigma_3 := \sigma_1 \cup \sigma_2 $
And this term : $t := f(x, y)$ are following substitu... |
T(1)=1
Func_two (n,b)
1) if (n=0)
2) then return 1
3) else if (n=1)
4) then return b
5) else if (mod(n,3)==0)
6) then return Func_two(n/3,b)
7) else
8) return b*Func_two(n-1,b)
How do I calculate this?
I see that $\mathcal{O}(\log(n))\le T(n) \le \mathcal{O}(n)$ because either we decrease by $1 $ all the time ... |
Question: Use the Pumping Lemma to show $L_1 = \Sigma^*\setminus\{0^n1^n: n\geq 0\}$ is not regular, for $\Sigma=\{0,1\}$ (without using the complement closure property).
My thoughts: I understand that $L_2 = \{0^n1^n: n\geq 0\}$ can be shown to be not regular using the Pumping Lemma by starting with a string in $L_2$ ... |
Question: prove that the grammar $G = (\{S\}, \{(,)\}, R, S)$ where $R$ consists of three rules:
$S \rightarrow (S)~|~SS~|~\epsilon$
generates precisely all well-balanced parentheses.
I found a source where it used induction on the length of string and the length of CFG derivation.
First of all, it seems for the backwa... |
This is about unrestricted grammars
Assume S is the start symbol. Assume 1 and 0 are terminal symbols. Assume all other symbols are non-terminal.
Given a set of (non-trivial) grammar rules,
is it always possible to order them, such that,
all the symbols on the left:
will be contained on the right in a previous rule
or... |
Disclaimer 1: I am a beginner in this domain and I am self-learning these concepts. Please take this in consideration when reading my question.
Disclaimer 2: All corrections to this question are highly encouraged. All self-learning PDF books etc. that helped you better understand these particular concepts are highly de... |
I understand that in Heaps we add them from left to right. I understand how to add and delete. But why is it from left to right, is there something that prevents it from being right to left or something like that. My intuition tells me that it has something to do with the index.
|
in a single board computer built around a 8085 processor, like in the old arcade/pinball games - what is the “role” of the EPROMs - am i correct, that they contain the code that the microprocessor runs..? i am most wondering if they are only active at turn-on, sending an instruction set to the microprocessor just once.... |
I am reading Introduction To Theory of Computation by Sipser, 3rd Edition and am confused by his take on the last three cases of proving that "if a language is described by regular expression then it is regular" on Page 67.
I don't understand how this proof guarantees that there will be an NFA for R1 and R2 in the firs... |
I thought up this problem and am trying to come up with an optimal solution.
I am thinking of a number uniformly randomly between 1-100, inclusive.
If you guess the number, you "win".
Else if you guess incorrectly, but are within 10 of the number, I will tell you "hot".
Else, I will tell you "cold".
For example, if ... |
I am currently being introduced to algorithms and I am trying to learn about showing the correctness. For training I chose the very basic linear-search algorithm and I would like to know if this is a correct proof. Thank you for your feedback!
Algorithm-Pseudocode:
function LinearSearch(Array A, int v):
for j=1 in A.... |
Question: Prove that the 6-rule CFG for arithmetic expressions below is unambiguous.
The CFG is as follows. $G = (V:=\{E,T,F\}, \Sigma:=\{+, \times,(,),x\},R,E\})$
where $R$ consists of 6 rules:
$E\rightarrow E+T ~|~ T~~~~~~ T\rightarrow T\times F|F~~~~~~ F\rightarrow (E) | x$
My thoughts: I think we should start by sh... |
Given a permutation $P$ and an integer $k$, we need to devise an algorithm which finds the $k$ disjoint increasing subsequences (say $L_1,L_2\ldots, L_k$) such that the sum total of their lengths (say $S_k$) is maximum is over any choice of $k$ disjoint increasing subsequences from a permutation $P$. For simplicity, on... |
I've had lectures and read other threads claiming that $k$-means clustering is NP-hard. The fact that they never mention NP-completeness makes me suspect that strict NP-hardness is what's meant. This makes intuitive sense to me: problems in NP can be verified in polynomial time w.r.t. the input, and it seems like recei... |
It's a widely known fact that $\lambda n. \left\lfloor \lg n! \right\rfloor \in \mathcal{O}(\lambda n. \left\lfloor \lg n \right\rfloor!)$. Is it also true (I tried and haven't found a counterexample so far) for all functions $f$ and $g$ satisfying $f \in \mathcal{o}(g)$, not just $f(n) = \left\lfloor \lg n \right\rflo... |
I have a vector of 2D Euclidean coordinates, and I need to find out if two or more points are within a distance threshold.
The naive approach is to compare each point with every other point, but I am not interested in O(n2) solutions. There are no other information or data that can be used to restrict the search space.... |
I have this NFA:
1,{2, 3}
2,empty
3,{4}
4,empty
All the arrows in this NFA are epsilon-arrows.
I understand that all possible states that can be reached from each of the states, using only epsilon paths are these:
E(1) = {1,2,3,4}
E(2) = {2}
E(3) = {3,4}
E(4) = {4}
However I don't understand how this state set was ac... |
This is a question from a previous exam in Graph theory and algorithms, the correct answer is E but I don't understand why.
Given a network flow $(G,c)$ over graph $G(V,E) $.
Assume we run Edmonds-Karp algorithm to find the max flow with the Max Bottleneck approach.
After $\frac{|E|}{2}$ iterations we decide to stop th... |
in "Introduction to Automata Theory, Languages and Computations" by Motwani, Ullman and Hopcroft, when they need to prove, for instance, Rice's theorem, they reduce the universal language, $L_u$, to the language $L_p$, where the latter is defined as the language containing the codes (binary) of all the TM $M$ such that... |
Some ISA's have instructions that are multiple words, such as the MOV instruction in x86. How does the program counter behave in that case, if the instruction loaded is more than one word? For example, the 5 byte MOV eax, 0x11223344 in x86, encoded as B8 44 33 22 11. In the case of that example, I would assume PC (EPI ... |
In graph theory, the lexicographic product or (graph composition) $G ∙ H$ of graphs $G$ and $H$ is a graph such that
the vertex set of $G ∙ H$ is the cartesian product $V(G) × V(H)$;
and any two vertices $(u,v)$ and $(x,y)$ are adjacent in $G ∙ H$ if and only if either $u$ is adjacent with $x$ in $G$ or $u = x$ and $v... |
PRNGs (pseudorandom number generators) generally have a bit length for the binary numbers they generate (e.g. 32 bits, 64 bits). This is the universe of their possible numbers.
It seems that they typically cycle when they reach their 2^bitlen number.
Is there one that, before it cycles, will generate each possible numb... |
I'm not convinced that substitutions are associative, I read the https://en.wikipedia.org/wiki/Substitution_(logic)#First-order_logic and the https://www.youtube.com/watch?v=_cVNeccMF-E
My problem is in this case, I use $\Rightarrow$ to mean reduces to
$( f(X,Y)\{X \rightarrow Y\} )\{Y\rightarrow X\} \\
\Rightarrow f(Y... |
Goal is proving grammar equivalence
Upper-case symbols are non-terminal.
Lower-case symbols are terminal.
The start symbol is S.
A grammar production rule is non-terminals-only if it only contains non-terminals. For example: AB -> CDE
A grammar rule is non-terminal-to-terminal if the left side has one non-terminal and... |
Background: How Percentile Approximation Works (and Why It’s More Useful Than Averages)
In traditional scenario, we store each value in an array/slice, in that case, we can just sort the array, and get the approximate percentile. For example,
[67, 68, 70, 71, 76, 78, 78, 79, 80, 98]
We could get the p90(90th percentil... |
Given a set B and B’s superset A, if B is missing 1 number (let’s y) but don’t know which number it is, how to find that number?
That is,
B’ = B \ {y}, for some unknown element y
B = A \ {x}, for some unknown elements x
I’d like to know y.
The original context is from Problem6,
Miners A and B each have a set of tr... |
Consider simple random walks that stop when reaching a given node $x$ in an undirected, unweighted and connected graph on $n$ nodes.
Let
$H(i,x)$ denote the (expected) hitting time from $i$ to $x$, with $H(x,x)=0$.
$H_{\max} = \max_{i \in V} H(i,x)$ and $H_{\text{avg}} = \frac{1}{n}\sum_{i \in V} H(i,x)$.
I am intere... |
Suppose you have to prove the solution to the following recurrence by Induction,
$$
T(n)=
\begin{cases}
\Theta(1), & n=1 \\
2 T(\lfloor n/2 \rfloor)+\Theta(n), & n>1
\end{cases}
$$
Here, $\Theta(1)$ and $\Theta(n)$ are notational abuse and they represent arbitrary positive constant and arbitrary linear function respec... |
For $1\ge p_1 \ge \dots \ge p_n \ge 0$, and for $i\in[n]$ draw $k$ iid binary strings with $m$ length:
$$X_{i,1},\dots,X_{i,k}\stackrel{iid}{\sim} \text{Bernoulli}(p_i)^m.$$
Viewing these binary strings as integers, define their ranks as
$$\text{rank}(i,s):=\#\{j\in[n]:X_{j,s}\ge X_{i,s}\}, \qquad \text{MinRank}(i):=\m... |
I have found this question some time ago. While reading it, I had a problem with understanding the following idea:
Question, part 1: Is one allowed to talk about the time/space bound of any algorithm (e.g. the $O(n)$ time bounded algorithm proposed in the cited question's comments) without considering at least one conc... |
Data only accessible in a scope, seems to still be maintained by the stack. What is the reason that entering and exiting scopes (in general) does not do the same "prologue and epilogue" instructions that are done when entering and exiting functions?
What test1 and test2 show, in test2 8 byte is allocated in the stack, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.