instruction
stringlengths
0
29.8k
⌀
I have been studying the assosciative mapping in a cache.Every line in a cache has a unique address which is made of:the index and the offset bits which give the the cache set and the cache line and the tag bits.But which algorithm really decides where to put information from RAM into the cache?
Assosciative mapping algorithm
|computer-architecture|cache|
null
null
Preliminaries ------------- In the case of a fully-associative or set-associative cache, there are multiple places where a cache line could be placed, which usually involves evicting an existing cache line. From the classic paper *[Design of CPU Cache Memories][1]* by Alan Jay Smith, the mean memory access time ...
{"Voters":[{"Id":162650,"DisplayName":"Paul Tanenbaum"}],"DeleteType":1}
Preliminaries ------------- In the case of a fully-associative or set-associative cache, there are multiple places where a cache line could be placed, which usually involves evicting an existing cache line. From the classic paper *[Design of CPU Cache Memories][1]* by Alan Jay Smith, the mean memory access time ...
Preliminaries ------------- In the case of a fully-associative or set-associative cache, there are multiple places where a cache line could be placed, which usually involves evicting an existing cache line. From the classic paper *[Design of CPU Cache Memories][1]* by Alan Jay Smith, the mean memory access time ...
null
null
null
The question is not clear. Is this the claim you are considering: If the largest clique in a graph $G=\langle V,E\rangle$ is of size $k<|V|$, then there exists a vertex $v\in V$ of degree $d\leq k-1$. If so then the claim is wrong. Let $d\geq 2$ and consider the full Bipartite graph $K_{d,d}=\langle V,E\rangle$,...
The question is not clear. Is this the claim you are considering: If the largest clique in a graph $G=\langle V,E\rangle$ is of size $k<|V|$, then there exists a vertex $v\in V$ of degree $d\leq k-1$. If so then the claim is wrong. Let $d\geq 2$ and consider the full bipartite graph $K_{d,d}=\langle V,E\rangle$,...
Showing that $\forall p\in\mathcal{P}.(pc_p=pc3 \lor pc_p=pc5 \iff n_p\gt0)$ requires some labour. While your intuition is correct, formally proving this fact requires a rigorous strategy. ***Preliminaries*** Let me put down some notation, so we can discuss unambiguosly. I assume the program implements a transit...
null
I have a conundrum to solve but am not knowledgeable enough about cryptography to know whether it's possible to do, and if so, what method to use. I am a Provider and my task is to prove to some outside Verifier the existence of a Connection to some device, beyond some reasonable probability $\epsilon$. The Verifie...
(Zero-knowledge?) Proof of Connection
|cryptography|authentication|zero-knowledge-proofs|
The Verifier must encrypt a message using the public encryption key of the device and ask the Prover to decrypt it. (Nobody knowing the private key.)
$$p_3\lor p_4\lor p_5\implies n[0]>0$$ is immediate: $n[0]$ is always non-negative and only modified by $p$. So it remains strictly positive from $p_3$ to $p_5$ inclusive as a postcondition of $p_2$. The reciprocal $$n[0]\implies p_3\lor p_4\lor p_5$$ is true because at initialization, $n[0]=0$ and as a postcondi...
I'm currently developing a custom UI layout library. At the moment a user of that library should supply strings for UI labels in a format that allow for subsequent shortening of those labels, so that they fit into the available space, without omission or indiscriminate ellipsis. Such a label list might look like this (...
Are there known algorithms for generating abbreviations from a (sequence) of words (similar to hyphenation)
|natural-language-processing|computational-linguistics|
null
I used a lot of HEX values when creating emulators too. There's a really good video of someone creating a N64 emulator using C++, and using HEX values makes it sooo much easier when playing with memory addresses. Javidx9 on YouTube does it, and I followed along with him a bit when making my own smaller CHIP8 emulato...
$$p_3\lor p_4\lor p_5\implies n[0]>0$$ is immediate: $n[0]$ is always non-negative and only modified by the process $p$. So it remains strictly positive from $p_3$ to $p_5$ inclusive as a postcondition of $p_2$. The reciprocal $$n[0]\implies p_3\lor p_4\lor p_5$$ is true because at initialization, $n[0]=0$ and as...
null
{"Voters":[{"Id":162650,"DisplayName":"Paul Tanenbaum"}]}
If your graph has $n$ vertices and you’re interested in $k$-cycles, then a brute-force inspection will look at each of the $n \choose k$ possible $k$-tuples. Thus, assuming that $k$ is small—in other words, that $k = O(1)$—that approach is $\Theta(n^k)$.
null
i have this question where im given a an array that contains the distance of a traveler from a certain destination at the i-th time of the day. ideally the array should be in descending order but the array could contain mistakes where the traveler gets further from the destenation and i should find at which index does ...
finding wrong elements in a descending sorted array using binary search
|c|
Consider the following step where 'abaab', upon failed mismatch, 'ab' the prefix is followed by aligning at 'ab' the suffix. What confuses me is the reason for being able to discard the possibility of a case where 'ab' may be inbetween the two also that might lead to a correct match. So why is it theoretically impossib...
KMP search: Can a shift by partial match prefix by non-suffix match lead to exact match?
|strings|string-matching|exact-string-matching|
My understanding is that recursive definitions are considered second-order since they require the fixpoint operator in order to be formulated as "true" definitions. This is even though they contain no higher order quantifiers eg. times(x,s(y)) = plus(x,times(x,y)) times(x,0) = 0 needs to be written as `t...
Are recursive Horn clauses first order?
|logic|recursion|prolog|
You can't solve this by binary search ! That's because even if you know the values at the endpoints of an interval containing the inversion, looking at the central value doesn't hint you in which half the inversion is. In the worst case, you can't spare an $O(n)$ search.
Let’s say you have one hundred data points. They should be in ascending order, but one of them has been modified. If you look at all but two data points, and you didn’t look at the wrong one, then you have no idea which of the two was incorrect. It could be either. Even if you looked at all data points except o...
Horn clauses in prolog are *not* recursive definitions. They are *logical formulas*. For example, ``` times(_, 0, 0). times(x, S(y), w) :- times(x,y,z), plus(x,z,w). ``` is *not* the definition of a recursive function, but just two logical formulas, written fully as \begin{gather*} \forall x .\, \mathtt{times}(x...
null
null
In order to group unstructured or sem-structured texts for a timeline construction approach, I consider several types of correlations among such texts. These different correlations induce a weighted <a href="https://en.wikipedia.org/wiki/Multigraph">multigraph</a>, where the texts act as nodes. All edges have a normali...
null
null
null
null
I'm trying to implement a very crude form of the css grid layout. It's layout algorithm is as [documented][1]. > “sparse” packing (default behavior) Set the column-start line of its placement to the earliest (smallest positive index) line index that ensures this item’s grid area will not overlap any occupied grid c...
Data Structure for Positioning Non-Overlapping Rectangles Into Grid
|computational-geometry|
I am struggling to write my own recursive function.I understand how to find the base case but I cant find easily the pattern on the relationship between 2 complicated cases.Do you know any website where I can practice that?
Having trouble on logic behind recursion
|recursion|
null
Wikipedia and other sources define "asymptotically equivalent" as: two functions $f$ and $g$ are asymptotically equivalent if: $$ \lim\limits_{x \to\infty}\frac{f(x)}{g(x)}=1 $$ But we regard $n^2$ and $2n^2$ as asymptotically equivalent, and these always have a ratio of 2 between them. Is there a different def...
Asymptotic equivalence allows difference by a constant factor?
|asymptotics|
There are multiple notions/definitions of asymptotic equivalence. You need to pick one that is appropriate for your goals. One notion of asymptotic equivalence is exactly as you have stated (see, e.g., https://en.wikipedia.org/wiki/Asymptotic_analysis). This notion cares about constant factors. It is commonly use...
$$p_3\lor p_4\lor p_5\implies n[0]>0$$ is immediate from the invariant: $n[0]$ is always non-negative and only modified by the process $p$; $n[1]$ is always non-negative and only modified by the process $q$. So $n[0]$ remains strictly positive from $p_3$ to $p_5$ inclusive as a postcondition of $p_2$. The reci...
null
$$p_3\lor p_4\lor p_5\implies n[0]>0$$ is immediate from the invariant: $n[0]$ is always non-negative and only modified by the process $p$. So $n[0]$ remains strictly positive from $p_3$ to $p_5$ inclusive as a postcondition of $p_2$. The reciprocal $$n[0]>0\implies p_3\lor p_4\lor p_5$$ is true because at ini...
$$p_3\lor p_4\lor p_5\implies n[0]>0$$ is immediate from the invariant: $n[0]$ is always non-negative and only modified by the process $p$. So $n[0]$ remains strictly positive from $p_3$ to $p_5$ inclusive as a postcondition of $p_2$. The reciprocal $$n[0]>0\implies p_3\lor p_4\lor p_5$$ is true because at ini...
$$p_3\lor p_4\lor p_5\implies n[0]>0$$ is immediate from the invariant: $n[0]$ is always non-negative and only modified by the process $p$. So $n[0]$ remains strictly positive from $p_3$ to $p_5$ inclusive as a postcondition of $p_2$. The reciprocal $$n[0]>0\implies p_3\lor p_4\lor p_5$$ is true because at ini...
Well, the old adage ain't wrong: To understand recursion, you first need to understand recursion. There are probably many books and webpages only a single search away. I would recommend you try to do very simple recursive functions first and then gradually solve harder and harder problems. Make sure that you **u...
The philosophy behind recursion is to decompose the problem in subproblem(s) *of the same nature* but easier in some respect, until the subproblems are so simple that you can solve them easily. For instance, to sort an array, you can move the small elements on the first side and the large ones on the last side and s...
The philosophy behind recursion is to decompose the problem in subproblem(s) *of the same nature* but easier in some respect, until the subproblems are so simple that you can solve them easily. For instance, to sort an array, you can move the small elements on the first side and the large ones on the last side and s...
An important thing to remember about recursion is that it is just another programming tool. Like all tools, it works well for what it is intended for, but is a terrible choice when used inappropriately. My suggestion is to study the types of problems where the use of recursion makes a natural solution. In my field (...
As input we are given a graph $G$ and an integer $k$ and are asked to find a dominating set of size **exactly** $k$ in $G$. This problem is clearly NP-hard, but does it become polynomial time solvable if we assume $G$ has bounded treewidth? For bounded treewidth graphs you can find a dominating set of size at most $k$ ...
Dominating sets and treewidth
|algorithms|graphs|parameterized-complexity|
Every graph with a DS of size $\leq k$ has a DS of size exactly $k$ (assuming $k$ is bounded by the number of vertices) as every superset of a DS is itself a DS.
There are multiple notions/definitions of asymptotic. You need to pick one that is appropriate for your goals. One approach to asymptotics is exactly as you have stated (see, e.g., https://en.wikipedia.org/wiki/Asymptotic_analysis). This notion cares about constant factors. It is commonly used in mathematics. St...
I am working on an floorplan application where I save elements on an infinite grid in a sparse manner. Specifically, I have the following Python class representing a sparse grid (basically a dictionary mapping coordinates to elements): from collections.abc import MutableMapping class SparseGrid(MutableMapping...
Combining chunks on an infinite grid into regions
|search-trees|python|square-grid|sparse-matrices|
{"Voters":[{"Id":139594,"DisplayName":"Chaos"}],"DeleteType":1}
{"Voters":[{"Id":139594,"DisplayName":"Chaos"}]}
null
Suppose $x_{ij}$ is number of times that word $j$ appears in document $i$. Then the *cosine similarity* between document $A$ and document $B$ is the normalised dot product: $$\mathit{sim}(A,B) = \frac{\sum_j x_{Aj} x_{Bj}}{\sqrt{\left(\sum_j x_{Aj}^2\right) \left(\sum_j x_{Bj}^2\right)}}$$ This is normalised to b...
The **circumference** of a graph is the length of any longest cycle in the graph. The problem should be NP complete. However, for graphs of moderate size, is there also a clever brute-force approach? I referred to the [link][1], where someone mentioned that the **Johnson's algorithm** is the most efficient. However...
Determining circumference of a graph
|graphs|
null
The **circumference** of a graph is the length of any longest cycle in the graph. The problem should be NP complete. However, for graphs of moderate size, is there also a clever brute-force approach? I referred to the [link][1], where someone mentioned that the **Johnson's algorithm** is the most efficient. However...
The **circumference** of a graph is the length of any longest cycle in the graph. The problem of determining circumference of a graph should be NP-complete. However, for graphs of moderate size, is there also a clever brute-force approach? I referred to the [link][1], where someone mentioned that the **Johnson's ...
I was thinking about the language `a^nb^nc^n`, which is obviously not context free, but if we run it through 2 automata at the same time (the first for `a` and `b` and the second for `b` and `c` and they bot accept, the construction would basically accept the language
Are 2 independent PDAs equivalent to a turing machine?
|formal-languages|turing-machines|pushdown-automata|
No, such a construct can recognise at most the intersection of two context-free languages. To see where it's lacking, consider $\{\textsf{a}^n\textsf{b}^n\textsf{c}^n\textsf{d}^n\textsf{e}^n~|~n\in\mathbb{N}\}$.
Multiply the cosine by one hundred.
Unfortunately the following problem is very hard: Long Cycle Input: a graph G and an integer k Question: does G have a simple cycle of length at least k? There is no fast algorithm for this problem. You should expect to use time proportional to 2^n
Unfortunately the following problem is very hard: **Problem:** Long Cycle <br> **Input:** A graph $G$ and an integer $k$<br> **Question:** Does $G$ have a simple cycle of length at least $k$? The problem is clearly NP-complete as it is a generalization of Hamiltonian Cycle (the problem has a cycle of length at ...
The language $\{a^nb^nc^n | n \in \mathbb{N}\}$ belongs to a strict subset of context-sensitive languages that can be expressed in terms of an intersection of two context-free languages. Having two PDAs cannot recognize a language like $\{a^nb^nc^nd^ne^n | n \in \mathbb{N}\}$.
The source of the confusion is that recognizability is defined in terms of a "there exists" statement. Recognizability is "one-sided" in regards to "yes" instances and "no" instances. Decidability is a strictly stronger condition than recognizability. Suppose the language $L$ is turing-recognizable (Chomsky Type 0):...
null
null
[Wikipedia](https://en.wikipedia.org/wiki/Asymptotic_analysis) and other sources define "asymptotically equivalent" as: two functions $f$ and $g$ are asymptotically equivalent if: $$ \lim\limits_{x \to\infty}\frac{f(x)}{g(x)}=1 $$ But we regard $n^2$ and $2n^2$ as asymptotically equivalent, and these always hav...