instruction
stringlengths
0
29.8k
⌀
null
There is a theorem stating that, given a random algorithm with a binary output that has a success probability $\geq 2/3$, you can always create the another algorithm that solves the same problem but with a success probability $\geq 1-\delta$ by just repeating the original algorithm $\mathcal{O}(1/\log\delta)$ times and...
null
>The Simon's problem is that, given a function $f:\{0,1\}^n\to\{0,1\}^n$ such that, for all $x,y\{0,1\}^n$ t satisfies $$ f(x)=f(y)\text{ iff }x=y\oplus s $$ where $s\in \{0,1\}^n$, and the Simon's problem is to find the secret string $s$ by querying $f$ as few as possible. Or in other words whether the function $f...
Analysis of Simon's Algorithm: Deriving Probability Expression for Matching Queries
|algorithm-analysis|probability-theory|lower-bounds|
Analysis of Simon's Algorithm: Probability Expression for Matching Queries
>The Simon's problem is that, given a function $f:\{0,1\}^n\to\{0,1\}^n$ such that, for all $x,y\{0,1\}^n$ t satisfies $$ f(x)=f(y)\text{ iff }x=y\oplus s $$ where $s\in \{0,1\}^n$, and the Simon's problem is to find the secret string $s$ by querying $f$ as few as possible. Or in other words whether the function $f...
null
null
null
I ran into this question that says: > With a given binomial heap with n elements and n is divisible by 8, split the heap into 2 binomial heaps, one with 3n/8 elements and the other with 5n/8 elements. So I tried using another heap as a helping heap that saves the heaps I need to merge, but I didn't exactly know h...
null
I ran into this exercise that says: > With a given binomial heap with n elements and n is divisible by 8, split the heap into 2 binomial heaps, one with 3n/8 elements and the other with 5n/8 elements. I tried using another heap as a helping heap that saves the heaps I need to merge, but I didn't exactly know how ...
null
The maximum cut problem is a combinatorial optimization problem that seeks to partition the vertices of a graph into two sets, $S$ and $T$, in a way that maximizes the number of edges that cross between the two sets. The problem is tractable for planar graphs. However, the vertices can be assigned to any of the two set...
Finding a Maximum Cut With Force Labeled Vertices for Planar Graphs
|np-hard|planar-graphs|bipartite-graph|max-cut|
null
null
null
Suppose given a black box $A$ that are told $A$ can compute invert a matrix (suppose the matrix be invertible) $M$ in $O(T_A)$. Also given a black box $B$ that are told $B$ Compute multiplication of two matrices $X$ and $Y$ in $O(T_B)$. There are two problems as follow: - How it possible compute $X\times Y$ by jus...
Compute matrices mulitplication using a black box and converse
|algorithms|
Suppose you're given a black box $A$, and you're told $A$ can invert a matrix (assuming the matrix is invertible) $M$ in $O(T_A)$. You're also given a black box $B$, and you're told $B$ can multiply two matrices $X$ and $Y$ in $O(T_B)$. **There are two problems as follow:** - How is it possible to compute $X \ti...
Compute matrix inversion / multiplication using a black box
|algorithms|matrices|matrix-multiplication|
null
It was shown in 1969, by Strassen, that matrix multiplication and matrix inversion have the same computational complexity. Details can be found on [Wikipedia](https://en.wikipedia.org/wiki/Computational_complexity_of_matrix_multiplication#Matrix_inversion,_determinant_and_Gaussian_elimination).
Reduction from Hamiltonian Cycle (which is just a special case of TSP anyway): Take an unweighted graph $G$ and make into a complete weighted graph $G'$ by adding a heavy edge (say, $\ell(e) = 2n$) for every $e\not\in E(G)$, and keeping $\ell(e)=1$ for $e\in E(G)$. For any vector $\mathbf{x}$, the subset of edges...
A special case of your problem, where the neighborhoods of the vertices you force together are disjoint, is equivalent to solving (regular) Max-Cut on an apex graph (a graph that is planar, save for one vertex). Let $D$ be the set of vertices that are forced to one side. Recall that the neighborhoods of vertices in ...
In [cuckoo hashing][1], an insertion failure occurs when there is an infinite loop of displacements. This is detected by a “max iterations” count on the insert function. When the insert fails, the table is rehashed using two new hash functions. These are selected from a given hash family. My question - how are th...
null
null
null
null
Great question, well, actually a family of questions :) Let's start with Cyckoo hashing. I checked the Wikipedia article to be sure, and indeed it doesn't mention any families. So, the answer is simple - you just use 2 hash functions, whose avalanche and other properties are good enough for you. These 2 functions...
null
If you only have one hash function $h$, you can turn it into two as follows: $$\begin{align*} h_0(x) &= h(0 || x)\\ h_1(x) &= h(1 || x) \end{align*}$$ where $||$ denotes concatenation. In other words, you prefix the value being hashed with an identifier of which hash function you are using.
I think there is quite a lot lacking from the above answers. Let’s first think about what an interrupt provides. An interrupt is how we accomplish preemption in a computer system. That is, stopping program execution in arbitrary positions in their code. All preemption in a computer system is accomplished via interr...
Let - $D(V, A)$ be a $k$-partite DAG; - $P = \{ p_k : 1 \leqslant k \leqslant |P| \}$ such that $p_k \cap p_l = \emptyset$, $\forall k,l : k \neq l$, and $\bigcup_{1 \leqslant k \leqslant |P|} p_k = V$ be the set of partitions; - $A = \{ (i, j) : \forall_{1 \leqslant k \leqslant |P| - 1} (i \in p_k \wedge j \in p_{...
Shortest paths in $k$-partite DAG
|graphs|shortest-path|partitions|dag|
null
If $|p_k|\leqslant N$ for all $k\in \{1, …, |P|\}$, then a dynamic programming algorithm can compute all those distance in $\mathcal{O}(|V|^2\times N)$ which could be lesser than $|V|^3$. The idea is the following: - if $i\in p_k$ and $j \in p_{k+1}$ for some $k$, $\ell_{ij} = d_{ij}$ (or $\infty$ if there is no ed...
null
null
null
Need a grammar that can create this language, I am having issues getting a language to work and was looking for help.
Creating a context-sensitive grammar (CSG) for the language L = {anbna2n: n ≥ 1}
|context-free|context-sensitive|
This is probably not the simplest, but here's a grammar for $L = \{a^nb^na^{2n} : n \geq 1\}$. Let $G = (\{S, A, B\}, \{a, b\}, P, S)$ where $P$ contains exactly $$S \to aAbaa$$ $$A \to aAbBB | \varepsilon$$ $$Bb \to bB$$ $$Ba \to aa$$ then $L(G) = L$.
null
I'm currently working on an interesting problem in function approximation thta just came to mind and am seeking insights or methodologies that might aid in approaching it. The problem is as follows: Given a continuous function say, $f(x) = \sin(x)$, I want to find a polynomial $P(x)$ of degree $n$, where each ...
An optimisation problem involving a special class of polynomials
|algorithms|time-complexity|
null
**Background:** I've a degree in computer engineering that I completed 5 years ago. I got really good grades at algorithms class but forgot everything that I studied. My notes were lost while migrating to a different place. Now, I want to relearn it. I have very little memory of how I learnt it at that time. ...
How to correctly learn algorithms?
|algorithms|
**Background:** I've a degree in computer engineering that I completed 5 years ago. I got really good grades at algorithms class but forgot everything that I studied. My notes were lost while migrating to a different place. Now, I want to relearn it. I have very little memory of how I learnt it at that time. ...
Replacing your $\{0,1\}$, respectively by $\{a,b\}$ and using more algebraic notation with $1$ in place of $ε$, the automaton can be presented either as a right-affine system $$ A ≥ a A + b B + 1,\quad B ≥ a C + b B,\quad C ≥ a A + b B,\quad A $$ or a left-affine system $$ A ≥ A a + C a + 1,\quad B ≥ A b + B...
null
Replacing your $\{0,1\}$, respectively by $\{a,b\}$ and using more algebraic notation with $1$ in place of $ε$, the automaton can be presented either as a right-affine system $$ A ≥ a A + b B + 1,\quad B ≥ a C + b B,\quad C ≥ a A + b B,\quad A $$ or a left-affine system $$ A ≥ A a + C a + 1,\quad B ≥ A b + B...
This problem is known as the preclusion number of a graph, or minimum blocker perfect matching problem. It was shown to be $\mathcal{NP}$-hard in <cite authors="Lacroix, Mathieu; Mahjoub, A. Ridha; Martin, Sébastien; Picouleau, Christophe">_Lacroix, Mathieu; Mahjoub, A. Ridha; Martin, Sébastien; Picouleau, Christophe...
Replacing your $\{0,1\}$, respectively by $\{a,b\}$ and using more algebraic notation with $1$ in place of $ε$, the automaton can be presented either as a right-affine system $$ A ≥ a A + b B + 1,\quad B ≥ a C + b B,\quad C ≥ a A + b B,\quad A $$ or a left-affine system $$ A ≥ A a + C a + 1,\quad B ≥ A b + B...
**Background:** I've a degree in computer engineering that I completed 5 years ago. I got really good grades at algorithms class but forgot everything that I studied. My notes were lost while migrating to a different place. Now, I want to relearn it. I have very little memory of how I learnt it at that time. ...
Using various [Kleene algebraic](https://en.wikipedia.org/wiki/Kleene_algebra) properties, such as the following $$ (u + v)^* = v^* (u v^*)^* = (v^* u)^* v^* = u^* (v u^*)^* = (u^* v)^* u^*,\\ u u^* = u^* u,\quad (u v)^* u = u (v u)^*,\quad u^* φ(u)^* = u^*,\\ u + v = v + u,\quad (u + v) w = u w + v w,\quad u 1 ...
As pointed out by Yuval Filmus in the comments, I assumed there that the formula had to be in 3CNF, which is not necessarily the case. However, I will let my answer, maybe it can still help. I may be wrong, but I think this problem is in $\mathsf{P}$, there is a reduction to $\texttt{2SAT}$. Consider a clause $C ...
I do not even know where to start with this assignment. I need to prove the following directly, that is, without using any Theorems or Lemmas. I have the following definitions: [![enter image description here][1]][1] [![enter image description here][2]][2] And i need to show: [![enter image description ...
How do I show the equivalence of these commands in denotational semantics
|denotational-semantics|
So I have been tasked to anonymize clinical data that..most of the time would be present in the form of tables. I've looked into algorithms like **generalization,redaction,K-anonymity, l-diversity,t-closeness**. But I am not sure how to robustly implement them. I've also looked into **Microsoft presidio**. Are th...
How can I anonymize/ de-identify clinical data present in tabular format
|algorithms|databases|security|differential-privacy|
A good text (even available for free) is Jeff Erickson's ["Algorithms"][1]. No, there is no solution manual. Algorithms is a required subject in the ACM/IEEE recommendations, you'll find lots of class notes, homework problems, exams by looking around on the 'net. Some areas that often are relegated to "graduate ...
I do not even know where to start with this assignment. I need to prove the following directly, that is, without using any Theorems or Lemmas. I have the following definitions: $$\begin{array}{rcl} \eta &: & A \to A_\bot\\ \eta\ a & = & \left\lfloor a \right\rfloor\\ (\star) & : & A_\bot \times (A\to B_\bot) \to ...
Have you considered [Universal Hashing][1] or [k-independent hashing][2]? I think either of those would be sufficient in the sense that they give good random performance on average, even if the input is chosen by an adversary (which would conform to a worst-case analysis setting). [1]: https://en.wikipedia.org/w...
So apparently the right answer here is [Tabulation hashing][1] which guarantees the behavior for Cuckoo hashing. The [linked paper][2] provides the rather technical details and proofs. [1]: https://en.wikipedia.org/wiki/Tabulation_hashing [2]: https://arxiv.org/pdf/1011.5200.pdf
null
While converting NFA to DFA the number of states in DFA can be different from NFA or the number of states in both remains the same?
Conversion of NFA to DFA
|automata|
You can do this with a variant of the Smith-Waterman algorithm. It assigns a penalty for an insertion or deletion, and also assigns a penalty for a substition, that depends on the two letters. (This is used for calculating the similarity of protein sequences, e.g. with a lower penalty for replacing an acidic residue wi...
I want to understand how the algorithm of selection sort sorts the given array, $$A[5]=\{5,9,11,10,2\}$$ Step -$1:-$ I compare A[0] with remaining elements of the array and since $A[4]<A[0]$ I swap them which leaves me with, $$A=\{2,9,11,10,5\}$$ Step-$2:-$ Repeating the similar procedure for $A[1]$ gives $$\{2,5...
Selection sort on the array $\{5,9,11,10,2\}$
|algorithms|sorting|c|
While converting NFA to DFA the number of states in both should be same or different?
I want to understand how the algorithm of selection sort sorts the given array, $$A[5]=\{5,9,11,10,2\}$$ Step -$1:-$ I compare A[0] with remaining elements of the array and since $A[4]<A[0]$ I swap them which leaves me with, $$A=\{2,9,11,10,5\}$$ Step-$2:-$ Repeating the similar procedure for $A[1]$ gives $$\{2,5...
I want to understand how the algorithm of selection sort sorts the given array, $$A[5]=\{5,9,11,10,2\}$$ Step -$1:-$ I compare A[0] with remaining elements of the array and since $A[4]<A[0]$ I swap them which leaves me with, $$A=\{2,9,11,10,5\}$$ Step-$2:-$ Repeating the similar procedure for $A[1]$ gives $$\{2,5...
You are stopping the `i` loop too soon. You should try it again and keep track of the value of $i$ and keep in mind that in an array of length $n$, indices of the array are between $0$ and $n-1$.
I have a dataset with 1055 samples and 168 features. I want to remove some features in order to train a model on my dataset. The model should output a binary field (either 0 or 1). **What are the sensibility analysis or data analysis algorithms that can help studying my dataset?** I would like some literature al...
Sensibility analysis for a discrete output data
|machine-learning|databases|
null
{"OriginalQuestionIds":[6063],"Voters":[{"Id":79440,"DisplayName":"Nathaniel"},{"Id":755,"DisplayName":"D.W."}]}
**Claim**: $L$ is context-free. **Proof Idea**: There has to be at least one difference between the first and second half; we give a grammar that makes sure to generate one and leaves the rest arbitrary. **Proof**: For sake of simplicity, assume a binary alphabet $\Sigma = \{a,b\}$. The proof readily extends to o...
null
null
What does it mean when you have a problem with n and it appears in a subscript as written above